Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Subdomain not working

$
0
0
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

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>