Report this

What is the reason for this report?

Can I host both Wordpress and non-Wordpress sites on the same VPS?

Posted on July 17, 2015

I am a front end designer and I have very little experience with how to host a website. I somehow stumbled through the console and FTP clients and got a few websites up and running but I want to create a proper infrastructure so I can easily get my sites up in the future.

Anyways, my question is, (how) can I host multiple websites with different and/or no CMS on one server?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

So here you go. We are going to use Ubuntu and Nginx

##Install the Software

sudo apt-get update
sudo apt-get install mysql-server php5-mysql nginx php5-fpm

##File Structure

mkdir /var/www/html/domain1
mkdir /var/www/html/domain2

##Nginx Configuration

Domain1

sudo nano /etc/nginx/sites-available/domain1

Copy and paste this

server {
        listen   80;
     

        root /var/www/html/domain1;
        index index.php index.html index.htm;

        server_name example.com;

        location / {
                try_files $uri $uri/ /index.html;
        }

        # pass the PHP scripts to FastCGI server listening on the php-fpm socket
        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
                
        }

}

save it

Domain2

sudo nano /etc/nginx/sites-available/domain2
server {
        listen   80;
     

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

        server_name example.com;

        location / {
                try_files $uri $uri/ /index.html;
        }

        # pass the PHP scripts to FastCGI server listening on the php-fpm socket
        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
                
        }

}

save it

##The last Step

sudo ln -s /etc/nginx/sites-available/domain1 /etc/nginx/sites-enabled/
sudo ln -s /etc/nginx/sites-available/domain2 /etc/nginx/sites-enabled/

Why Nginx ?

  • It is much faster
  • Easy to manage

PS: If it works click that hearth to show me some love

Hello,

I created a Tutorial.

Just one note, I wanted to make it easy as possible, so 99% are just Pictures :-).

The Tutorial. 36h available :-(

If you want, i may create a snapshot and transfer it to you. I just need your E-Mail address. It is even possible to create a text-version or video if you want

Well, though it is been answered in quiet a bit of a detail, just wanted to add, that a VPS is meant for this purpose. You can host an array of different CMSes on the same server with just a restriction of resources like CPU, RAM & Disk Space vis-a-vis your visitors to these sites :)

– Regards Saurabh

Servopia.com Managed Cloud Hosting For PHP Applications

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.