NutzCN Logo
问答 请教下,nginx如何配置就可以通过ip直接访问系统
发布于 2441天前 作者 qq_4a89c7c9 2057 次浏览 复制 上一个帖子 下一个帖子
标签: nginx

通过nginx,怎么配置可以直接通过ip访问系统呢

5 回复

监听80端口

已经是监听80端口了

upstream test{
    ip_hash;
    server 127.0.0.1:8080;
    server 127.0.0.1:9090;
}
server {
    listen  80;
    server_name  test;
    index  index.html index.htm index.php index.jsp;
    location / {
	    index  index.html index.htm index.php index.jsp;
	     proxy_buffer_size 64k;
	    proxy_buffers   32 32k;
	    proxy_busy_buffers_size 128k;
	    proxy_set_header Host $host;

	    proxy_set_header X-Real-IP $remote_addr;
	    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

	    proxy_set_header HTTP_X_FORWARDED_FOR $remote_addr;
	    proxy_pass http://test;

	    error_log   /home/log/nginx/test_error.log;
	    access_log /home/log/nginx/test_access.log main;
    }

}

所以,直接访问ip,比如47.47.47.47,就直接访问到了tomcat的界面了,而不是系统的登录界面。

把项目部署到webapps/ROOT

添加回复
请先登陆
回到顶部