1. 程式人生 > >nginx新增站點

nginx新增站點

1.修改配置檔案

vim /usr/local/nginx/conf/nginx.conf

新增一個server節點:

server {
        listen          81;
        server_name     localhost;
        access_log      logs/test.log;
        location / {
            index index.html;
            root  html/test;
        }
    }

2.建立站點目錄

cd /usr/local/nginx/html/
mkdir test
cd test
vim index.html

網頁內容如下:

<h1>Hello Nginx!</h1>

 

3.過載配置

cd /usr/local/nginx/sbin/
./nginx -s reload

 

4.訪問檢視效果

我這個是虛擬機器的Ip

http://192.168.43.139:81