Welcome! Log In Create A New Profile

Advanced

Subdomain not working

Posted by girish_kumar 
Subdomain not working
June 26, 2019 09:03AM
Hi,

I what to setup three domain in my nginx server running on linux and I am getting into some issues basically
the subdomain is not working

myserver.com
platform.myserver.com
www.myserver.com

The following is what I had done

1. Installed nginx and tested it works fine
2. when to /etc/nginx/sites-available/
3. Copied /etc/nginx/sites-available/default file to /etc/nginx/sites-available/myserver.com
4. Then created a link in /etc/nginx/sites-enabled/myserver.com
The contents of myserver looks as follows

server {
listen 80 ;
listen [::]:80 ;
root /var/www/myserver.com;
index myserver.html
server_name myserver.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}

5. Renamed the file default in /etc/nginx/sites-available/ to so default.xxx (practically deleted)

With this I am able to access http://myserver.com from any where in the internet.
I can see the contents stored in /var/www/myserver.com. So far all good.

6. I need to enable the second subdomain platform.myserver.com. I followed the above steps for platform

7. Copied /etc/nginx/sites-available/default file to /etc/nginx/sites-available/platform.myserver.com

8. Then created a link in /etc/nginx/sites-enabled/platform.myserver.com
The contents of platform.myserver.com is given below
server {
listen 80 ;
listen [::]:80 ;
root /var/www/platform;
index platform.html
server_name platform.myserver.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}

I had copied different content into root /var/www/platform

Now I had tried to access platform.myserver.com

The problem the server is going to the same root folder of /var/www/myserver.com and showing the contents
instead of showing the contents from /var/www/platform

Can you give me some clues or tips to debug this issue. Not able to figure out the issue here.

Regards
Girish
SOLVED: Subdomain not working
June 26, 2019 09:28AM
Folks no need to respond to this I had figured out what the problem is semicolon was missing and I correct it and it worked
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 304
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready