以前使用apache,有时候访问 localhost ,居然提示403 access die ,但有时候过几天又可以(没有修改过任何配置的情况下),很诡异,出现这样情况的时候不管是怎么修改配置都是提示403无权限!几率很低但一直无法解决。
换 nginx 后就没有再出现这样问题,autoindex 用的很爽。
配置文件 localhost.conf :
大家都知道,在进行J2EE项目的开发过程中,在调试阶段如果只是修改了页面是不需要重启应用服务器的,比如不需要重启Tomcat。只需要在浏览器中 进行页面刷新即可。其实之所以不用重启Tomcat等应用服务器,其根本原因是因为我们可以在应用服务器的配置文件中设置虚拟目录,这样就可以知道web 项目所在的目录,于是就可以省去打包、然后再重新发布到服务器的步骤。感兴趣的朋友可以过来看看
0
其中对 http://localhost/phpmyadmin/ alias别名到phpmyadmin!
server {
listen 80;
server_name localhost 127.0.0.1 "";
root d:/localhost;
index index.html index.htm index.php;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
location /phpmyadmin {
root d:/wamp/apps/phpmyadmin4.1.14;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ /\.(ht|svn|git) {
deny all;
}
}
以上就介绍了nginx localhost 配置,开启目录浏览,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号