Nginx,ssl服务,rewrite ,反向代理
Posted PHPYuan
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Nginx,ssl服务,rewrite ,反向代理相关的知识,希望对你有一定的参考价值。
server{
listen 80;
#listen 443 ssl;
server_name www.baidu.com baidu.com;
root "F:/demo";
#ssl_certificate F:/demo/key/www.baidu.com_ssl.crt;
#ssl_certificate_key F:/demo/key/www.baidu.com.key;
location /app/ {
index index.html index.htm index.php l.php;
autoindex off;
if ($request_uri !~ ^/app/(application|api|resource|html|img|images|help|js|css|robots.txt|index.php|uploads)(.*))
{
#rewrite ^/app/resource/(.*)$ /app/resource/$1 last;
rewrite ^(.*)$ /app/index.php/$1 last;
break;
}
}
location ~ .php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
location /app_other/ {
#proxy_next_upstream http_502 http_504 error timeout invalid_header;
proxy_pass http://14.215.177.37:7999;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root "F:/demo";
}
}
以上是关于Nginx,ssl服务,rewrite ,反向代理的主要内容,如果未能解决你的问题,请参考以下文章
Nginx stream如何获取ssl信息并反向代理至上游服务器
带有两种 SSL 到 weblogic 的 nginx 反向代理