Can't get subdomain to work nginx, debian 9

ralphot

Member
Joined
Jun 13, 2021
Messages
35
Reaction score
13
Credits
253
I have this in sites-available for the subdomain (there are two others, https://www.webshooter.se and http://www.webshooter.se):
## For support.webshooter.se subdomain
server {
listen 80;
listen [::]:80;
server_name support.webshooter.se;
root /var/www/support.webshooter.se;
index index.html index.php;
}
and it's linked to sites-enabled.

Have put this in the /etc/hosts file:
127.0.1.1 support.webshooter.se
When I ping locally:
[email protected]:/etc# ping support.webshooter.se
PING support.webshooter.se (127.0.1.1) 56(84) bytes of data.
64 bytes from ws02 (127.0.1.1): icmp_seq=1 ttl=64 time=0.051 ms
64 bytes from ws02 (127.0.1.1): icmp_seq=2 ttl=64 time=0.051 ms

But "Server not found" in browser. http://support.webshooter.se

What do I miss?
 


f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
5,575
Reaction score
4,143
Credits
40,707
You probably forgot to open port 80 in your firewall?
 

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
5,575
Reaction score
4,143
Credits
40,707
From the system where you added the hosts file entry can you try doing the following requests and share the output?
Code:
curl -I support.webshooter.se
curl -I support.webshooter.se/index.php
curl -I support.webshooter.se/index.html
 
OP
R

ralphot

Member
Joined
Jun 13, 2021
Messages
35
Reaction score
13
Credits
253
From the system where you added the hosts file entry can you try doing the following requests and share the output?
Code:
curl -I support.webshooter.se
curl -I support.webshooter.se/index.php
curl -I support.webshooter.se/index.html
Will do.
 
OP
R

ralphot

Member
Joined
Jun 13, 2021
Messages
35
Reaction score
13
Credits
253
[email protected]:/var/www# curl -I support.webshooter.se
HTTP/1.1 200 OK
Server: nginx/1.18.0 (Ubuntu)
Date: Mon, 14 Jun 2021 20:05:37 GMT
Content-Type: application/octet-stream
Content-Length: 180
Last-Modified: Sat, 12 Jun 2021 20:10:10 GMT
Connection: keep-alive
ETag: "60c514a2-b4"
Accept-Ranges: bytes

[email protected]:/var/www# curl -I support.webshooter.se/index.php
HTTP/1.1 200 OK
Server: nginx/1.18.0 (Ubuntu)
Date: Mon, 14 Jun 2021 20:06:54 GMT
Content-Type: application/octet-stream
Content-Length: 180
Last-Modified: Sat, 12 Jun 2021 20:10:10 GMT
Connection: keep-alive
ETag: "60c514a2-b4"
Accept-Ranges: bytes

[email protected]:/var/www# curl -I support.webshooter.se/index.html
HTTP/1.1 404 Not Found
Server: nginx/1.18.0 (Ubuntu)
Date: Mon, 14 Jun 2021 20:08:30 GMT
Content-Type: text/html
Content-Length: 162
Connection: keep-alive

I have a index.php no .html in the support page.
 
Last edited:
OP
R

ralphot

Member
Joined
Jun 13, 2021
Messages
35
Reaction score
13
Credits
253
I have also another "subdomain" on the same server:
[email protected]:/etc# curl -I http://www.webshooter.se/index.html
HTTP/1.1 200 OK
Server: nginx/1.18.0 (Ubuntu)
Date: Mon, 14 Jun 2021 21:10:27 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 1770
Last-Modified: Sun, 06 Jun 2021 14:43:12 GMT
Connection: keep-alive
ETag: "60bcdf00-6ea"
X-Frame-Options: SAMEORIGIN
Accept-Ranges: bytes

This works and the difference from the others is: X-Frame-Options: SAMEORIGIN
 
Last edited:

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
5,575
Reaction score
4,143
Credits
40,707
[email protected]:/var/www# curl -I support.webshooter.se
HTTP/1.1 200 OK
Server: nginx/1.18.0 (Ubuntu)
Date: Mon, 14 Jun 2021 20:05:37 GMT
Content-Type: application/octet-stream
Content-Length: 180
Last-Modified: Sat, 12 Jun 2021 20:10:10 GMT
Connection: keep-alive
ETag: "60c514a2-b4"
Accept-Ranges: bytes

[email protected]:/var/www# curl -I support.webshooter.se/index.php
HTTP/1.1 200 OK
Server: nginx/1.18.0 (Ubuntu)
Date: Mon, 14 Jun 2021 20:06:54 GMT
Content-Type: application/octet-stream
Content-Length: 180
Last-Modified: Sat, 12 Jun 2021 20:10:10 GMT
Connection: keep-alive
ETag: "60c514a2-b4"
Accept-Ranges: bytes

[email protected]:/var/www# curl -I support.webshooter.se/index.html
HTTP/1.1 404 Not Found
Server: nginx/1.18.0 (Ubuntu)
Date: Mon, 14 Jun 2021 20:08:30 GMT
Content-Type: text/html
Content-Length: 162
Connection: keep-alive

I have a index.php no .html in the support page.
Looking at this output the webserver isn't the problem:
1. You get an OK/200 back which is good.
2. You also get an OK/200 back.
3. You get an 404/Not found back since the file doesn't exist but it is a response from the webserver so it's working as expected.

I think the problem is somewhere else, also check the log file of the subdomain that may give you some more information.
 
Last edited:
OP
R

ralphot

Member
Joined
Jun 13, 2021
Messages
35
Reaction score
13
Credits
253
Looking at this output the webserver isn't the problem:
1. You get an OK/200 back which is good.
2. You also get an OK/200 back.
3. You get an 404/Not found back since the file doesn't exist but it is a response from the webserver so it's working as expected.

I think the problem is somewhere else, also check the log file of the subdomain that may give you some more information.
log file of the subdomain? Where can I find that? What I have in /var/log/nginx is: 0 Jun 15 06:25 webshooter.se-error.log empty and nothin comes there if I update support.webshooter.se. Strange...
 
OP
R

ralphot

Member
Joined
Jun 13, 2021
Messages
35
Reaction score
13
Credits
253
Sorry, han no error enabled in the sites-enable file for the support-page. Have that now but no errors occur when updating page. Very odd.
 
Last edited:

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
5,575
Reaction score
4,143
Credits
40,707
What does: X-Frame-Options: SAMEORIGIN means that comes with the working subdomain?
That has nothing to do with the problem since that's just a header, that's usually defined in the virtualhost of the subdomain.
log file of the subdomain? Where can I find that? What I have in /var/log/nginx is: 0 Jun 15 06:25 webshooter.se-error.log empty and nothin comes there if I update support.webshooter.se. Strange...
Usually you define a separate log file per virtualhost or subdomain, if you haven't done than that it probably goes all in the same log file.

Is support.webshooter.se on the same server as the other domain you mentioned, that way I can try adding it to my hosts file.
Code:
www.webshooter.se.    3600    IN    A    194.54.164.156
 
OP
R

ralphot

Member
Joined
Jun 13, 2021
Messages
35
Reaction score
13
Credits
253
I have a resolv.conf contains:
nameserver 127.0.0.53
options edns0
Thank you for taking time to help me...:)
 
Last edited:

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
5,575
Reaction score
4,143
Credits
40,707
If I add this to my hosts file.
Code:
194.54.164.156 support.webshooter.se
And then the page loads.
2021-06-15_11_58_51.jpg
 
OP
R

ralphot

Member
Joined
Jun 13, 2021
Messages
35
Reaction score
13
Credits
253
I put that in my hosts file with same result, but it have to work on the server, all users can not do that?
 
MALIBAL Linux Laptops

Linux Laptops Custom Built for You
MALIBAL is an innovative computer manufacturer that produces high-performance, custom laptops for Linux.

For more info, visit: https://www.malibal.com

Members online


Top