nginx 新手,请教点配置问题。
server {
listen 80;
server_name fanjianlu.com;
server_name www.fanjianlu.com;
root /home/webfile;
index index.html index.htm;
location ~ .*\.(htm|html)$
{
root /home/webfile; #set resource file
expires 1h;
}
location ~ .*\.(js|css)$
{
root /home/webfile; #set resource file
expires 1h;
}
location ~ .*.(action*|jsp*)$ #is jsp and action and .do from tomcat
{
index index.action;
proxy_pass http://211.149.207.191:8080;#ret url from tomcat
}
location ~ .*\.(ico|gif|jpg|jpeg|png|bmp|swf|txt|html|htm)$ #Set access to static files directly read without tomcat
{
root /home/webfile; #The default Web site root directory location defined server
expires 30d;
}
location / {
proxy_pass http://211.149.207.191:8080;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
ssi on;
ssi_silent_errors on;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
我这里由于是tomcat 里面的action无后缀名,现在tomcat能够访问,文件也能够访问但是就是直接输入域名index.html跳转到tomcat下面去了。我想要直接输入域名能进入/home/webfile 目录
相关推荐
nginx配置引发的403问题解决办法
主要介绍了nginx配置引发的403问题解决办法的相关资料,需要的朋友可以参考下
新手3步搞定Nginx网页404问题
摘要: 新手在服务器部署HTML网页时,常因文件路径与Nginx配置不匹配导致404错误。本文通过3个步骤解决问题:1) 将HTML文件正确放置到Nginx默认目录/var/www/html/;2) 检查Nginx配置文件,确保root路径指向正确位置;3) 重启Nginx服务使配置生效。文中提供了详细命令解析和配置说明,并总结了新手常见的路径混淆、配置未激活和防火墙拦截三大坑。通过实际案例演示,帮助读者快速排查和解决网页访问问题。
nginx配置ssl实现https访问的步骤(适合新手)
主要给大家介绍了关于nginx配置ssl实现https访问的相关资料,这个教程非常适合新手小白,文中通过示例代码将实现的方法一步步介绍的非常详细,需要的朋友可以参考借鉴,下面来一起看看吧
nginx配置https之后,https请求被调转到http问题
修改之前,nginx的配置如下: upstream local_tomcat_wechat{ server 127.0.0.1:80 weight=2 fail_timeout=1s; } server { listen 443; server_name www.xxxx.com; error_log /nginx/log/www.xxxx.com.error.log warn; ssl on; ssl_certificate /nginx/nginxcert/xxxxxx.pem;
nginx如何配置代理转发
如何配置nginx代理转发,仔细查看配置的各种路径,以及路径指定的资源


