Hi, I have one site already set up on Nginx and tried to add a second but is not working.
Every time I try to access the second field I am directed to the first domain. What might be happening?
site1 = inforlogia.com site2 = tudodesconto.com
config for site1:
server {
listen 80 default_server;
error_log /var/www/error.log;
access_log off;
root /var/www/inforlogia.com;
server_name inforlogia.com;
index index.php;
include /etc/nginx/wordpress.conf;
}
config for site2:
server {
listen 80;
listen [::]:80;
error_log /var/www/error.tudodesconto.log;
access_log off;
root /var/www/tudodesconto.com;
server_name tudodesconto.com;
index index.php;
include /etc/nginx/wordpress.conf;
}
wordpress.conf
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location / {
try_files $uri $uri/ /index.html;
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
}
location ~ \.conf$ {
deny all;
}
if (!-e $request_filename)
{
rewrite ^(.+)$ /index.php?q=$1 last;
}
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
I solved the problem. I changed (each block):
server {
server_name inforlogia.com;
......
}
to
server {
server_name inforlogia.com www.inforlogia.com;
......
}
I spent two days on it …
This comment has been deleted
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.
