1、主配置文件nginx.conf
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name e.huisou.com;
include proxy.conf;
location / {
proxy_pass http://192.168.0.252:8090;
}
}
server {
listen 80;
server_name user.huisou.com;
include proxy.conf;
location / {
proxy_pass http://192.168.0.252:8080;
}
}
server {
listen 80;
server_name login.huisou.com;
include proxy.conf;
location / {
proxy_pass http://192.168.0.252:8070;
}
}
server {
listen 80;
server_name copydata.huisou.com;
include proxy.conf;
location / {
proxy_pass http://192.168.0.252:8030;
}
}
server {
listen 80;
server_name img.e.huisou.com;
location / {
root /var/img;
}
}
# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
2 、proxy.conf,在上面配置文件中include该文件,在tomcat的配置中host的name属性改成域名时,HttpServletRequest对象的getRequestURL方法取得的是该域名而非本地IP
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
分享到:
相关推荐
nginx配置 nginx配置文件参考 nginx配置文件参考
Nginx配置文件说明.一些配置文件中详细参数的说明,可以看看。
Nginx 配置文件
在此记录下Nginx服务器nginx.conf的配置文件说明, 部分注释收集与网络. #运行用户 user www-data; #启动进程,通常设置成和cpu的数量相等 worker_processes 1; #全局错误日志及PID文件 error_log /var/log/...
一个完整的nginx配置文件范例参考(含负载均衡)。学习,支持开源,支持nginx
解析nginx配置文件,并将nginx配置文件格式化成对象,方便java程序管理nginx配置。解析配置文件并非使用正则匹配,而是使用语法分析树处理解决的。 标签:nginx
Nginx配置文件原始版本,这是刚下来的Nginx服务器最原始的版本内容,下载覆盖即可。
Nginx配置文件 nginx.conf 详解doc文档
nginx配置文件-安装客户端ip进行转发 具体可查看zip包中的nginx.conf及default.vhosts.conf
nginx配置文件中斜杠/的6种含义 nginx配置proxy_pass时,/的6种含义+没有/的含义 nginx配置proxy_pass时,斜杠的6种含义,不写斜杠/的含义
nginx配置文件vim语法高亮与缩进.docx
使得notepad++编辑nginx的配置文件(.conf)时,支持语法的高亮显示,非常方便
nginx配置文件修改保存,自动加载重启,并检查配置文件是否修改成功。 Windows下使用nginx,启动之后,再修改配置文件,无需命令重新加载,修改保存配置文件,实时更新nginx重启。
一个开源的Linux下运行... 该工具从Apache Web服务器中的各模块功能的角度进行分析,生成Nginx中相应模块的配置方式,然后以报告的形式生成转换后的Nginx配置文件。 官网:https://github.com/leeleander/apache2nginx
Nginx配置文件的对应模块及模块属性详细说明。此外,还有一个实例帮助更好的了解Nginx配置
基于docker容器的nginx配置文件,包含反向代理和负载均衡配置,具体使用和操作可以参见我的博客 nginx docker下搭建环境和配置文章
docker安装nginx配置文件
nginx.conf nginx-1.20.1.tar.gz 这是关于centos8的nginx 和nginx 的配置https文件
对nginx配置文件nginx.conf各个表示的意思进行解释,方便新人学习
nginx配置多个站点共用80端口,具体方法可以参见博文: https://blog.csdn.net/zengmingen/article/details/80302241