Help adding multiple WP sites on LEMP

Posted April 11, 2015 2.7k views

Hi have my brand new LEMP server up and running. So far I have configured 1 website, which is running without problems, configuring the DNS of my domain in godaddy and everything looks good.

Now, I’ve tried to add another website, doing exactly the same as I did for my first WP website, and I can’t make it run.

Whats happening is, when I go on the browser to or, it works well, it goes to the website path that I configured on the server block. But when I go to, it opens the website of the but without changing the domain on the browser, I mean, on the browser you still can see the address, but it loads the site from the

And when I go to, it loads the main screen of the nginx server.

But when put on the brower the IP of my server, it loads the content of the

I tried everything that I could, but nothing seems to work…any help?

I have a server block with this configuration, in /etc/nginx/sites-available/ and enabled /etc/nginx/sites-enabled/:

server {
    root /var/www/html/web/web1;
    access_log /var/log/nginx/;
    error_log /var/log/nginx/;
    include global/common.conf;
    include global/wordpress.conf;
server {
    root /var/www/html/secure/web2;
    access_log /var/log/nginx/;
    error_log /var/log/nginx/;
    include global/common.conf;
    include global/wordpress.conf;

I have common.conf file in /etc/nginx/global with this:

# Global configuration file.
# ESSENTIAL : Configure Nginx Listening Port
listen 80;
# ESSENTIAL : Default file to serve. If the first file isn't found, 
index index.php index.html index.htm;
# ESSENTIAL : no favicon logs
location = /favicon.ico {
    log_not_found off;
    access_log off;
# ESSENTIAL : robots.txt
location = /robots.txt {
    allow all;
    log_not_found off;
    access_log off;
# ESSENTIAL : Configure 404 Pages
error_page 404 /404.html;
# ESSENTIAL : Configure 50x Pages
error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/www;
# SECURITY : Deny all attempts to access hidden files .abcde
location ~ /\. {
    deny all;
# PERFORMANCE : Set expires headers for static files and turn off logging.
location ~* ^.+\.(js|css|swf|xml|txt|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
    access_log off; log_not_found off; expires 30d;

And another file in common for the wordpress sites:

# WORDPRESS : Rewrite rules, sends everything through index.php and keeps the appended query string intact
location / {
    try_files $uri $uri/ /index.php?q=$uri&$args;

# SECURITY : Deny all attempts to access PHP Files in the uploads directory
location ~* /(?:uploads|files)/.*\.php$ {
    deny all;
# REQUIREMENTS : Enable PHP Support
location ~ \.php$ {
    # SECURITY : Zero day Exploit Protection
    try_files $uri =404;
    # ENABLE : Enable PHP, listen fpm sock
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
# PLUGINS : Enable Rewrite Rules for Yoast SEO SiteMap
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
1 comment

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.

Submit an Answer
2 answers

@ -> myserverip
admin -> myserverip



Thats the same configuration that I have for my domain that already works ( in my example)

I just configured the DNS in my domain provider (godaddy). Should I do anything else related to DNS on my server?