bgslvsky
By:
bgslvsky

Running regular html site along side wordpress mu on lemp

December 13, 2015 399 views
PHP Nginx WordPress Configuration Management LEMP DNS Ubuntu

Hi everyone,

I'm having issues putting getting two host name blocks working together. I have a lemp server which has a Wordpress MU setup. I would also like to run a seperate website/domain for a regular html site.

So I have domain1.com which is WP MU
domain2.com which is a regular html site.

I followed this tutorial to setup my wordpress mu
https://www.digitalocean.com/community/tutorials/how-to-set-up-wordpress-multisite-with-nginx-on-ubuntu-14-04

I have WP MU setup my working perfectly.

My domain1.com configuration looks like this:

server {
    listen [::]:80 ipv6only=off;
    server_name domain1.com *.domain1.com;

    root /usr/share/nginx/wordpress;
    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php?$args ;
    }

    location ~ /favicon.ico {
        access_log off;
        log_not_found off;
    }

    location ~ \.php$ {
        try_files $uri /index.php;
        include fastcgi_params;
    }

    access_log  /var/log/nginx/$host-access.log;
    error_log   /var/log/nginx/wpms-error.log;
}

My domain2.com config looks like this

server {
    listen 80;
    listen [::]:80;

    root /var/www/domain2.com/html;
    index index.html index.htm;

    server_name domain2.com www.domain2.com;

    location / {
        try_files $uri $uri/ =404;
    }
}

When I try to restart ngnix it fails. What is also strange is that when I go to my server ip or domain2.com it automatically redirects to my domain1.com/wp-signup page

Could someone shed some light on what I'm doing wrong?

1 Answer

What does the Nginx error log say? This always hands over important and usefull information you can use to debug your vhosts.

/var/log/nginx/error.log
Have another answer? Share your knowledge.