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

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?

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
1 answer

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