Nginx is not preserving the path when using domain name - nginx

My application is running on Nginx webserver. I can access the application through my server DNS name. Example :
ec2-xxxxxx/myapp
If I enter the address without /myapp, I can see Nginx 403 Forbidden error.
I have now created a new sub-domain on my Domain control panel and Forwarding the request to the root address.
I can see the 403 error when accessing the sub-domain, however when I enter subdomain.mydomain.com/myapp, I still see the 403 Forbidden error. Somehow the relative path is not being preserved when calling from the domain name.
Is this problem related to resolving DNS at my domain registry, or it's an Nginx config issue?

Its a nginx config issue. You need to create the virtual host for your subdomain. Post that you should be able to access your app from your subdomain.

The problem was with the Domain registry (GoDaddy) and had nothing to do with Nginx config.
After moving from GoDaddy to AWS Route53, I can easily access sub-domain with it's relative paths.

Related

Nginx as Reverse Proxy for Prestashop

I have this scenario with Nginx as reverse proxy and Prestashop:
I have Prestashop installed as a container with Proxmox and it has been configured with a local IP address (192.168.0.10) instead of a domain name. I can access Prestashop via the local IP without problems through the local network.
I have nginx as a reverse proxy installed on another VM that receives the request with a domain name (subdomain.example.com) with an SSL certificate on the Nginx, and makes a proxy_pass for the local IP address (192.168.0.10).
When the request is made via the external domain Prestashop redirects [subdomain.example.com] to [192.168.0.1] which is not expected.
With other attempts returns the error (too many redirects) ...
other attempts returns the error 500 ...
I've already tried to enable SSL on prestashop, assign the domain [subdomain.example.com] on prestashop, activate multistore and several other attempts without any success.
I found a tutorial that suggest do edit de [Link.php] file on Prestashop but don't work for me too.
I can't find any material on the web that solves this problem, nor in the Prestashop documentation, so I ask for your help.
This is probably a misconfiguration in Prestashop as your webserver config is pretty straightforward.
Please make sure :
that your DB table ps_shop_url is containing the correct subdomain.example.com in domain and domain_ssl row.
that .htaccess file in Prestashop in root folder is not containing references to your backend IP (192.168.0.1) - If this is the case, you'll need to regenerate in from backoffice (click SAVE in Seo&URL tab )

How to configure nginx to access website using www

I have setup a raspberry pi web server. I'm using nginx and google domains. I have a conf file for that domain in sites-available I configured the server_name to my domain name www.domain.com .domain.com;
The problem is that I can only access the website using .domain.com. When I try using www.domain.com I get redirect to ISP page (unable to find..).
Login to your domain provider's dashboard
If you haven't already added an A record to your DNS settings select Manage DNS and add an A record pointing to your IP address of the host.
You'll essentially need to add a CNAME record to your domain's DNS settings. The 'Name' field should be www
Depending on your provider you may have to wait till about 2- 48hrs to allow it to propagate.

Can't find my wordpress site when using www

If I do example.com my site is there, but when adding www. or http://www. I get the error message: server DNS address could not be found.
I'm pointing my domain to EC2 on Amazon Web Services.
What am I missing?
You have to add a CNAME record for the www subdomain pointing at your EC2 Ip and also I recommend you to make a permanent redirect on your virtual host config file of your web server (apache for example) to redirect http://myexample.com to http://www.myexample.com. If you do not prefer making a permanent redirect you need to include www.myexample.com in your virtual host file as an alias.
Do you have CNAME DNS records set for www on GoDaddy? Try set www to # under DNS Settings CNAME. Read support article here

IIS Subdomain Host Headers Not Working

Using IIS 7, I have an existing website, example.com, and I have added another website to which I'd like the URL, sub.example.com to point. I've set up the host headers for this, but it does not work. Trying to ping the subdomain URL give the message "Ping request could not find host sub.example.com. Please check the name and try again."
Should a DNS setting perhaps be set?
The subdomain must be set in the DNS or it will not resolve to an IP address. Just having it defined in IIS is not enough. The client computer must be able to translate the name into a meaningful server address.

subdomain with rewriteModule

i'm using this rule for rewriting subdomain
and i'm corrected host file to
127.0.0.1 domain.net
when user typed news.domain.net/default.aspx it must return domain.net/news/default.aspx but browser showed Address not found.
how do i?
please help
thanks all
When you add the entry to your HOSTS file, it will only correct the exact DNS lookup - in your example, "Domain.net" would resolve to 127.0.0.1, but "news.domain.net" won't resolve to anything, since there's no server at that address. If you add an entry to your HOSTS file for:
127.0.0.1 news.domain.com
That will resolve that domain to your local machine, and then you can configure IIS to rewrite that URL to whatever you want.

Resources