Nginx ubuntn16.04 configuration of multi-site

nginx multi-site configuration

Reference the blog: https://www.linuxidc.com/Linux/2017-11/148532.htm

  • First you have to create a new Nginx configuration
//进入目录
cd  /etc/nginx/sites-enabled
//拷贝配置文件
cp default site1
//修改配置文件
vim site1

Modify the configuration file, modify the port information
Here Insert Picture Description
to modify the site root

Here Insert Picture Description
Save out!

  1. Then we create a website directory under index.php
//进入根目录
cd /var/www
//创建网站文件夹
mkdir site1
//进入目录
cd site1
//创建index.php
vim index.php
//在文件中写入
<?php
   echo phpinfo();
?>
//保存退出,重启一下nginx
sudo service nginx restart
  1. Then we visit our domain name, or IP, accessed via ip or domain name, later to add: port number! Can not access the service provider's gonna open that port job Oh!
    Here Insert Picture Description
    If the following chart shows, on behalf of multi-site configuration successful!
    Here Insert Picture Description

Guess you like

Origin blog.csdn.net/HKer_YM/article/details/93762220