我需要在nginx上为wildfly服务器设置虚拟主机。 我早些时候使用Apache虚拟主机,我想在nginx中做类似的设置我已经按照这篇文章http://nginx.org/en/docs/http/request_processing.html和http:// developer-should- know.tumblr.com/post/112512171397/nginx-serving-static-content-and-java-application
这是我的conf文件
server { listen 80; server_name www.example.com; access_log logs/www.example.com_access.log; error_log logs/www.example.com_error.log; location / { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:8080; root /var/www/www.example.com/public_html; index index.html ; try_files $uri $uri/ =404; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }
在我的根目录我有index.html
<html> <head> <meta http-equiv="Refresh" content="0;url=/Test/hello.jsp"> <title>Index Redirect</title> </head> </body>
我需要将我的请求从http://127.0.0.1:8080/发送到我的根目录index.html,它将redirect到/Test/hello.jsp;
如何实现这一点。请告诉我,我在这里做错了什么