linux下配置Nginx

配置流程如下:

 1.安装linux(就不说了)

 2.安装Nginx:sudo apt-get install nginx (具体命令查)

 3.默认配置文件在/etc/nginx/nginx.conf

     如果没有,可以搜索 find / -name nginx;

 4.nginx.conf文件结构一言难尽,可查资料

 5.关心nginx.conf主要结构:

server {
         listen         80;   --/*端口*/
         server_name     _;/*域名*/

         access_log      /var/log/nginx/access.log main; /*访问目录*/
          location / {
              root  /usr/share/nginx/html; /*虚拟目录*/
              index index.html;
         }
 }

5.配置好后 /etc/init.d/nginx restart 重启

6.OK

原文地址:https://www.cnblogs.com/bobsoft/p/2714548.html