lidabo

在安装完nginx服务后,url访问的默认路径是安装的路径html文件夹下的内容,如果需要指定自定义的路径,需要配置nginx.conf文件内容,这样通过url访问就可以了,比如: http://127.0.0.1/ 对应的物理路径 c:/a/b/c

修改配置文件:

 

[html] view plain copy
 
 print?
  1. server {  
  2.   listen 80;  
  3.   server_name localhost;  
  4.   #charset koi8-r;  
  5.   #access_log logs/host.access.log main;  
  6.   location / {  
  7.     #这里设置你的实际路径  
  8.     root /home/ftpuser/www/;   
  9.     index index.html index.htm;  
  10.     }  
  11. }  

 

重启nginx再访问,如果访问提示 Nginx 403 Forbidden

需要在nginx.conf头部加入一行

 

[html] view plain copy
 
 print?
  1. user root;  

 

重启nginx再访问,就可以正常访问了

分类:

技术点:

相关文章:

  • 2021-06-20
  • 2022-12-23
  • 2021-07-26
  • 2021-08-09
  • 2021-11-02
  • 2022-12-23
  • 2021-08-26
  • 2021-06-15
猜你喜欢
  • 2022-12-23
  • 2021-05-07
  • 2021-10-12
  • 2021-11-05
  • 2021-12-18
相关资源
相似解决方案