Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi, friends... it's a nginx question, I've been stuck on this issue for quite a while and I was unable to find a solution. I'm posting here hope that some brilliant minds in this community can help.
My issue is that I have a domain name tianyushi.net and now it works well. I want to redirect www.tianyushi.net to tianyushi.net.
I've used a CNAME for DNS, and when I dig the www domain, I get the following results:
Code:
tiashi@LSGC02DT7TFMD6R notebook % dig www.tianyushi.net
;; ANSWER SECTION:
www.tianyushi.net. 680 IN CNAME tianyushi.net.
tianyushi.net. 681 IN A 162.255.119.225
So I believe that the DNS side is good.
However, when I try to open www.tianyushi.net, I get a 404 error, which I think is a problem on the Nginx side.
I used the this config with instructions from Google:
hi thanks bathory, I reloaded & restarted nginx, still not working... may I ask how can I debug this issue? I even cannot see any access or error logs for nginx when accessing www.tianyushi.net, only can get this 404 err info from the browser..
Summary
URL: http://www.tianyushi.net/
Status: 404 Not Found
Source: Network
Address: 162.255.119.225:80
Request
GET / HTTP/1.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Upgrade-Insecure-Requests: 1
Host: www.tianyushi.net
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6.1 Safari/605.1.15
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: keep-alive
hi bathory... I changed my conf with your help, but still with the same issue... I cannot get any log from nginx side, do you think it's a DNS issue?
It's not a DNS issue. Both hostnames resolve correctly to the same IP
Perhaps your nginx server is not aware of www.tianyushi.net. Check the config file(s) for the various server_name directives.
If you're running a debian based distro look under /etc/nginx/sites-enabled for the vhosts that nginx is aware of.
It's not a DNS issue. Both hostnames resolve correctly to the same IP
Perhaps your nginx server is not aware of www.tianyushi.net. Check the config file(s) for the various server_name directives.
If you're running a debian based distro look under /etc/nginx/sites-enabled for the vhosts that nginx is aware of.
Hi bathory, after getting several 404 errs, I revisited namecheap's website and added a redirect for the 'www' subdomain to point to 'tianyushi.net' with a Permanent (301) on namecheap side. This solved the issue, but I'm curious if you think it was a configuration issue with Namecheap's side nginx. When I checked the DNS records using the 'dig' command, it returned an IP address of '162.255.119.225', which is namecheap's nginx server instead of my own. It appears that namecheap was forwarding the traffic instead of directing it to my server.
However, I'm still unsure why I was unable to bypass namecheap's settings by redirecting the 'www' subdomain to the non-www version on my own nginx server.
It's not a DNS issue. Both hostnames resolve correctly to the same IP
Perhaps your nginx server is not aware of www.tianyushi.net. Check the config file(s) for the various server_name directives.
If you're running a debian based distro look under /etc/nginx/sites-enabled for the vhosts that nginx is aware of.
I got the root cause, thanks again for the advice! Initially, I had been using namecheap DNS to directly redirect the domain to my host: port, which was using its own nginx server. However, I have now updated the DNS settings by mapping the domain to my host IP using an A record, and the nginx server on my side is now working properly. Thank you for your prompt response!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.