tar -xzf nginx-1.15.9.tar.gz -C /usr/src/
useradd www
cd nginx-1.15.9
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install
启动Nginx:
/usr/local/nginx/sbin/nginx
查看Nginx进程:
通过浏览器访问:
二、配置虚拟主机
编辑nginx.conf文件(/usr/local/nginx/conf目录下):
创建test1、test2目录,并在两个目录中创建网站页面:
mkdir -p /usr/local/nginx/html/test{1,2}
echo 'this is test1' >> /usr/local/nginx/html/test1/index.html
echo 'this is test2' >> /usr/local/nginx/html/test2/index.html