1.前提
已安装配置好nginx+ftp服务
2.配置Nginx 服务器
2.1进入nginx 配置文件目录:
cd /usr/local/nginx/conf
vi nginx.conf
2.2 修改配置文件:有两种方式
①方式一:在配置文件server{}中location /{} 修改配置
1 #默认请求 2 location / { 3 root /home/ftpuser/www;#定义服务器的默认网站根目录位置 4 index index.html index.php index.htm;#定义首页索引文件的名称 5 }
②方式二:在http{}内配置新服务
1 server { 2 listen 8080; 3 server_name localhost; 4 5 #charset utf-8; 6 7 #access_log logs/host.access.log main; 8 9 #默认请求 10 location / { 11 root /home/ftpuser/www;#定义服务器的默认网站根目录位置 12 index index.html index.php index.htm;#定义首页索引文件的名称 13 } 14 }
我的配置(方式一):