I want to host multiple wordpress websites on a Ubuntu 16.04 (Ubuntu-NGINX-MariaDB-PHP). I don't want to use wordpress multisite.
I followed this guide . Everything is fine but I can host only one site. Whenever I created multiple server block configuration, it starts to show error and NGINX fail to start. I am not getting my config file correct. Here is the config file :
server {
listen [::]:80 ipv6only=off;
server_name abcde.org www.abcde.org;
root /var/www/abcde;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?q=$uri&$args;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php7.0-cgi alone:
fastcgi_pass 127.0.0.1:9000;
# # With php7.0-fpm:
# fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
If I host only one website, it works fine. But as soon as I host the other website, NGINX fail to start. I use same config for both sites, after changing the server name and root directory.
Kindly guide me for the right configuration for NGINX server blocks.
Your nginx.config needs something like this line. This is what I do on my server
In that directory you can have one file with many servers, or you can do what I do and have servers grouped by domain.
File abcde.conf
File example.conf
File default_server.conf