I have live server GCE (google cloud computing engine) and I created server block or virtual host, I created also DNS subdomain to my go daddy account and point to the i.p address of my GCE.I am new in nginx and I would like to know if we create multiple server block is this can be view on mobile also ...I tried to view in my mobile but only the first virtual host is always viewed...also if I will not edit my host file in my desktop if I will access my site or all my subdomain . it will abnormally display instead of secondsubdomain.mymaindomain.com the page will display is my firstsubdomain and it will display the i.p address Not firstsubdomain.mymaindomain.com.. can someone help me please what is missing in my configuration. I have created 2 virtual-host in /etc/nginx/sites-available/ . It's been 3 weeks for me to figure out and searching some help but no luck. I hope someone will help me.
banking.mydomain.com
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/banking/public/;
index index.php index.html index.htm;
server_name banking.mydomain.com;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
inventory.mydomain.com
server {
listen 80;
listen [::]:80;
root /var/www/inventory/public/;
index index.php index.html index.htm;
server_name inventory.mydomain.com;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Thank you in advance.