#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;
worker_rlimit_nofile 204800;

events {
worker_connections 204800;
multi_accept on;
use epoll;
}

http {
include mime.types;
default_type application/octet-stream;

log_format test166 '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'"[$request_time]" "[$upstream_response_time]" '
'"[$connection]" "[$connection_requests]" '
'"$http_imei" "$http_mobile" "$http_type" "$http_key" "$cookie_sfpay_jsessionid"';
access_log logs/access.log test166;

sendfile on;
#tcp_nopush on;
underscores_in_headers on;

keepalive_timeout 65;
proxy_connect_timeout 10s;
proxy_read_timeout 120;
proxy_send_timeout 60;
proxy_buffer_size 16k;
proxy_buffers 4 64k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;
proxy_temp_path /home/temp_dir;
proxy_cache_path /home/cache levels=1:2 keys_zone=cache_one:200m inactive=1d max_size=30g;

client_header_buffer_size 12k;
open_file_cache max=204800 inactive=65s;
open_file_cache_valid 30s;
open_file_cache_min_uses 1;

fastcgi_intercept_errors on;

gzip on;
gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png image/jpg;

upstream ims-oms {
server 10.118.240.31:8001;
}

upstream up_cms {
server 10.118.242.206:8080;
# server 10.118.244.163:8080;
}
upstream up_adms {
server 10.118.242.206:8082;
#server 10.118.200.19:8080;
}
upstream up_psfm {
server 10.118.242.206:8081;

}
# HTTP server
#
server {
listen 8080;
server_name 10.118.213.96;

location /nginx_status {
stub_status on;
access_log off;
}
location /cms {
proxy_pass http://10.118.244.163:8080/cms;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host:8080;
index login.jsp;
#proxy_redirect default;
proxy_cache off;
}

location /Adms {
proxy_pass http://up_adms/Adms;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
#proxy_redirect https://10.118.213.96:8443/Adms /adms;
proxy_cache off;
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'OPTION, POST, GET';
}

# redirect server error pages to the static page /50x.html
#
error_page 400 403 404 500 502 503 504 /40x.html;
location = /40x.html {
#proxy_pass https://127.0.0.1:8080/notice.png;
root html;
}
# redirect server error pages to the static page /40x.html
#

location ~*\.(gif|jpg|jpeg|ico|gif|png|bmp|js|css)$ {
root images;
}

location = /favicon.ico {
log_not_found off;
access_log off;
}
}

#HTTPS SERVER
#
server {
listen 8443;
server_name 10.118.213.96;

ssl on;
ssl_certificate server.key;
ssl_certificate_key server.pem;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers
AES128-SHA:AES256-SHA:RC4-SHA:DES-CBC3-SHA:RC4-MD5;
ssl_prefer_server_ciphers on;

rewrite '/(login)/(.*)' /cms/$1/$2;
#rewrite '/Adms/(.js|css)' https://xbox.sf-pay.com/Adms/$1;
location /cms {
proxy_pass http://up_cms/cms;
#proxy_pass http://10.118.244.163:8080/cms/;
#proxy_redirect default;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
server_name_in_redirect on;
}

location /psfm{
proxy_pass http://up_psfm/psfm;
#proxy_pass http://10.118.244.163:8080/cms/;
#proxy_redirect default;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
server_name_in_redirect on;
}

location / {
proxy_pass http://up_cms/cms/login.jsp;
rewrite '/(.*)/(.*)' /cms/$1/$2;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
}

location /AutoDeploy {
proxy_pass http://up_cms/AutoDeploy;
#proxy_pass http://10.118.244.163:8080/cms/;
#proxy_redirect default;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
server_name_in_redirect on;
}

#location /Bugzilla {
#proxy_pass http://up_cms/Bugzilla;
# proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-Proto https;
#}

location /Adms {
proxy_pass http://up_adms/Adms;
#proxy_pass http://10.118.242.206:8082/Adms/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
#proxy_redirect https://10.118.213.96:8443/Adms /adms;
proxy_cache off;
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'OPTION, POST, GET';
}

error_page 400 403 404 500 502 503 504 /40x.html;
location = /40x.html {
#proxy_pass https://127.0.0.1:8443/notice.png;
root html;
}

location ~*\.(gif|jpg|jpeg|ico|gif|png|bmp)$ {
root images;
}

location = /favicon.ico {
log_not_found off;
access_log off;
}
}
}

----------------------------------------------

#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;
worker_rlimit_nofile 204800;

events {
worker_connections 204800;
multi_accept on;
use epoll;
}

http {
include mime.types;
default_type application/octet-stream;

log_format test166 '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'"[$request_time]" "[$upstream_response_time]" '
'"[$connection]" "[$connection_requests]" '
'"$http_imei" "$http_mobile" "$http_type" "$http_key" "$cookie_sfpay_jsessionid"';
access_log logs/access.log test166;

sendfile on;
#tcp_nopush on;
underscores_in_headers on;

keepalive_timeout 65;
proxy_connect_timeout 10s;
proxy_read_timeout 120;
proxy_send_timeout 60;
proxy_buffer_size 16k;
proxy_buffers 4 64k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;
proxy_temp_path /home/temp_dir;
proxy_cache_path /home/cache levels=1:2 keys_zone=cache_one:200m inactive=1d max_size=30g;

client_header_buffer_size 12k;
open_file_cache max=204800 inactive=65s;
open_file_cache_valid 30s;
open_file_cache_min_uses 1;

fastcgi_intercept_errors on;

gzip on;
gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png image/jpg;

upstream ims-oms {
server 10.118.240.31:8001;
}

upstream up_cms {
server 10.118.242.206:8080;
# server 10.118.244.163:8080;
}
upstream up_adms {
server 10.118.242.206:8082;
#server 10.118.200.19:8080;
}
upstream up_psfm {
server 10.118.242.206:8081;

}
upstream up_syAssistant {
server 10.118.242.206:8088;

}
# HTTP server
#
server {
listen 8080;
server_name 10.118.213.96;

location /nginx_status {
stub_status on;
access_log off;
}
location /cms {
proxy_pass http://up_cms/cms;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
index login.jsp;
#proxy_redirect default;
proxy_cache off;
}
location /psfm {
proxy_pass http://up_psfm/psfm;
#proxy_pass http://10.118.244.163:8080/cms/;
#proxy_redirect default;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-Proto https;
server_name_in_redirect on;
proxy_cache off;
}
location /syAssistant {
proxy_pass http://up_syAssistant/syAssistant;
#proxy_pass http://10.118.244.163:8080/cms/;
#proxy_redirect default;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-Proto https;
server_name_in_redirect on;
proxy_cache off;
}
# redirect server error pages to the static page /50x.html
#
error_page 400 403 404 500 502 503 504 /40x.html;
location = /40x.html {
#proxy_pass https://127.0.0.1:8080/notice.png;
root html;
}
# redirect server error pages to the static page /40x.html
#

location ~*\.(gif|jpg|jpeg|ico|gif|png|bmp|js|css)$ {
root images;
}

location = /favicon.ico {
log_not_found off;
access_log off;
}
}

#HTTPS SERVER
#
server {
listen 8443;
server_name 10.118.213.96;

ssl on;
ssl_certificate server.key;
ssl_certificate_key server.pem;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers
AES128-SHA:AES256-SHA:RC4-SHA:DES-CBC3-SHA:RC4-MD5;
ssl_prefer_server_ciphers on;

#rewrite '/(login)/(.*)' /cms/$1/$2;
#rewrite '/Adms/(.js|css)' https://xbox.sf-pay.com/Adms/$1;
location /cms {
proxy_pass http://up_cms/cms;
#proxy_pass http://10.118.244.163:8080/cms/;
#proxy_redirect default;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
server_name_in_redirect on;
}

location /psfm {
proxy_pass http://up_psfm/psfm;
#proxy_pass http://10.118.244.163:8080/cms/;
#proxy_redirect default;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
server_name_in_redirect on;
}

# location / {
# proxy_pass http://up_cms/cms/login.jsp;
# rewrite '/(.*)/(.*)' /cms/$1/$2;
# proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-Proto https;
# }

# location /AutoDeploy {
# proxy_pass http://up_cms/AutoDeploy;
#proxy_pass http://10.118.244.163:8080/cms/;
#proxy_redirect default;
# proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-Proto https;
# server_name_in_redirect on;
# }

#location /Bugzilla {
#proxy_pass http://up_cms/Bugzilla;
# proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-Proto https;
#}

# location /Adms {
# proxy_pass http://up_adms/Adms;
# #proxy_pass http://10.118.242.206:8082/Adms/;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header Host $host;
# #proxy_redirect https://10.118.213.96:8443/Adms /adms;
# proxy_cache off;
# add_header 'Access-Control-Allow-Origin' '*';
# add_header 'Access-Control-Allow-Credentials' 'true';
# add_header 'Access-Control-Allow-Methods' 'OPTION, POST, GET';
# }

error_page 400 403 404 500 502 503 504 /40x.html;
location = /40x.html {
#proxy_pass https://127.0.0.1:8443/notice.png;
root html;
}

location ~*\.(gif|jpg|jpeg|ico|gif|png|bmp)$ {
root images;
}

location = /favicon.ico {
log_not_found off;
access_log off;
}
}
}

----------------------------带nginx目录访问的配置

[tomcat@app01 conf]$ more 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 8443;
server_name localhost;
#root /home/nginx/nginx-home/android/sit;
root /home/nginx/nginx-home/download/;
autoindex on;
autoindex_exact_size on;
autoindex_localtime on;

location ~ ^/NginxStatus/ {
stub_status on;
access_log off;
}

}

server {
listen 8088;
server_name localhost;

#charset koi8-r;
charset utf-8;
access_log logs/host.access.log main;
autoindex on;
autoindex_exact_size on;
autoindex_localtime on;

location ~ ^/NginxStatus/ {
stub_status on;
access_log off;
}

location / {
#root html;
root /home/nginx/nginx-home/download;
index index.html index.htm;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}

# 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配置-http和https的更多相关文章

  1. Windows下Nginx配置SSL实现Https访问(包含证书生成)

    Vincent.李   Windows下Nginx配置SSL实现Https访问(包含证书生成) Windows下Nginx配置SSL实现Https访问(包含证书生成) 首先要说明为什么要实现https ...

  2. Centos7.2下Nginx配置SSL支持https访问(站点是基于.Net Core2.0开发的WebApi)

    准备工作 1.基于nginx部署好的站点(本文站点是基于.Net Core2.0开发的WebApi,有兴趣的同学可以跳http://www.cnblogs.com/GreedyL/p/7422796. ...

  3. 使用SSL安全证书和nginx配置将域名HTTPS化

    一.在阿里云后台申请免费版证书: 二.在域名解析里面添加记录: 三.提交审核: 四.等待审核通过后,下载nginx证书: 五.按照文档修改nginx配置文件: https://help.aliyun. ...

  4. linux下nginx配置ssl证书(https)

    nginx配置ssl很简单,首先需要两个文件,一个是crt文件,另一个是key文件,如下所示: xxx.crt;  #(证书公钥)xxx.key; #(证书私钥) 把这两个文件放到nginx的conf ...

  5. nginx配置自签名https

    nginx配置https是需要CA颁发证书的,为了测试方便,我们可以使用自签名证书 1.如何生成自签名证书 1.1:我们需要为服务端和客户端准备私钥和公钥: //生成服务器端私钥 openssl ge ...

  6. nginx 配置多个 https 域名访问

    需要此操作的原因 在服务器上部署了 halo blog 以后,这次需要部署另外一个项目,但是又不想使用 ip + port,因此选择使用 nginx 配置多个域名访问. nginx 配置 server ...

  7. 阿里云Center OS 6.2 Nginx 配置 SSL/TLS HTTPS配置

    1.通过https://www.startssl.com/ 免费SSL证书 STARTSSL 跟VeriSign一样,StartSSL(网址:http://www.startssl.com,公司名:S ...

  8. windows:nginx配置http、https反向代理

    一.下载 Windows 版本的 nginx nnginx下载:http://nginx.org/en/download.html 推荐稳定版本.下载完成后,解压得到 nginx-1.14.0 ,我把 ...

  9. Nginx配置SSL实现HTTPS访问

    nginx配置文件如下: server { listen 443 ssl; server_name www.domain.com; root /www/web; index index.html in ...

随机推荐

  1. GCD的多线程实现方式,线程和定时器混合使用

    GCD (Grand Central Dispatch) 性能更好,追求性能的话 1.创建一个队列 //GCD的使用 //创建一个队列 dispatch_queue_t queue = dispatc ...

  2. ERP联系人查询和修改(十六)

    查看和修改是同一个界面: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="L ...

  3. iOS传值方式:属性,代理,block,单例,通知

    正向传值均可,反向传值除属性传值不可,其余均可.下面简单介绍: (一)属性传值 第二个界面中的lable显示第一个界面textField中的文本 首先我们建立一个RootViewControllers ...

  4. Unity3D ShaderLab 漫反射卷积光照模型

    Unity3D ShaderLab 漫反射卷积光照模型 漫反射卷积[Diffuse convolution]是一个模糊立方体的过程,它保留了立方图的整体光照强度,只模糊了细节. 这种效果在我们要活得一 ...

  5. Nullsoft教程 NSIS初学者图文教程一

    Nullsoft教程 NSIS初学者图文教程一 来源:互联网 作者:佚名 时间:03-29 00:34:33 [大 中 小] Nullsoft Installation System(nsis) 是一 ...

  6. 重学STM32---(八)----SDIO

    1. SDIO(SD/SDIO MMC卡主机模块)在AHB外设总线和多媒体卡(MMC).SD存储卡.SDIO卡和CE-ATA设备间提供了操作接口.(SDIO没有SPI兼容的通信模式 ) 1.1.什么是 ...

  7. EditText 控件

    <EditText android:layout_width="fill_parent" android:layout_height="wrap_content&q ...

  8. Linux Qt动态库的创建和使用

    一.创建动态库 编写一个共享库类,比如: //..base.h class Base : public QObject { Q_OBJECT public: ); void PrintLog(QStr ...

  9. Play Framework常用标签list,set,如何遍历list、map类型数据

    最近一段时间的项目都是在Play这个框架上进行开发的,挺强大的,但不足之处也挺多的.今天分享下play中强大的标签,遍历list,map类型的数据的用法. 遍历单纯的list数据,例如:List< ...

  10. android的style控制Theme

    value-v14就是在API14(4.0)的手机上所使用的Theme(其他版本以此类推) theme的名字叫做AppTheme,后面写有继承自哪个Theme,如下所示 <style name= ...