前言:
当前大家对“nginx博客园”大致比较关切,我们都想要知道一些“nginx博客园”的相关内容。那么小编同时在网上汇集了一些关于“nginx博客园””的相关文章,希望咱们能喜欢,小伙伴们一起来学习一下吧!前置条件已申请域名包括备案成功SSL证书已获得Nginx部署方式为源码部署,不会的请参考Linux安装nginx - star-xin - 博客园nginx已加载SSL模块,不会的请参考nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf:37 - ノGHJ - 博客园
nginx.conf正文(直接复制粘贴)
改成自己域名、要转发的http地址
#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; client_max_body_size 5000m; #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; # Tomcat upstream appServer { server 127.0.0.1:8080 weight=4; } server { listen 80; # listen somename:8080; server_name 域名 ; rewrite ^(.*) permanent; } server { listen 443 ssl; # https 443 charset utf-8; server_name 域名; # host_name of URL # https #ssl on; ssl_certificate 证书地址.pem; ssl_certificate_key 证书地址.key; location / { proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # https Tomcat Tomcat http proxy_set_header X-Forwarded-Proto $scheme; # Tomcat proxy_pass 自己的http请求; } } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #}}
版权声明:
本站文章均来自互联网搜集,如有侵犯您的权益,请联系我们删除,谢谢。
标签: #nginx博客园 #nginx转发到tomcat