How to install two wordpress and a static html website on Centos 7 with Nginx

October 12, 2014 2.3k views

Please help me in installing my three website on Centos 7 with Nginx. I have complete the initial server setup and ready with LEMP stack.
Also created DBs for respective wordpress. But I am not sure about how to configure and where to put files of wordpress installation in this particular case. Any help is appreciated.

1 Answer

You can use /srv/httpd/mysite.domain.tld/public to put your content (AKA, WordPress files, HTML files, etc). And then you can use /srv/httpd/mysite.domain.tld/log for the log files. You just need to configure Nginx root to where the public folder resides.

  • Presently I have put them in following dir like:

    Now how to Set Up Nginx Server Blocks? - it's only here I am strucked :(

  • You have to set the root to those directories on each block.

    I've given a very bare config below:

    In /etc/nginx/sites-available/wordpress1

    server {
      listen 80;
      listen [::]:80;
      root /var/www/wordpress1;
      server_name wordpress1.tld;

    In /etc/nginx/sites-available/wordpress2

    server {
      listen 80;
      listen [::]:80;
      root /var/www/wordpress2;
      server_name wordpress2.tld;

    In /etc/nginx/sites-available/web3

    server {
      listen 80;
      listen [::]:80;
      root /var/www/web3;
      server_name web3.tld;

    Now to activate those sites, just run ln -s /etc/nginx/sites-available/sitename /etc/nginx/sites-enabled/ then restart Nginx.

  • As sites-available/ and sites-enabled/ dir were not there so I created them manually and after that I
    followed all your mentioned steps.

    And then configured DNS also. It propagated and reflected the IP changes.
    But when hitting the site, its showing me the Nginx deafult page instead of wordpress installation page.

    Please note that i have installed LEMP using this tutorial : Link

    Please help.

    In this guide, we'll get a LEMP stack installed on an CentOS 7 VPS. A LEMP software stack is a group of open source software that is typically installed together to enable a server to host dynamic websites and web apps. This term is actually an acronym which represents the **L**inux operating system, with the **E**Nginx web server (which replaces the Apache component of a LAMP stack). The site data is stored in a **M**ySQL database (using MariaDB), and dynamic content is processed by **P**HP.
  • Ah. My bad. I missed the OS you were running. Those directories are on Debain-based systems. It seems for CentOS /etc/nginx/conf.d/ is where your configs are. You will want to make your configs there.

Have another answer? Share your knowledge.