nginx配置参考2
来源:互联网 发布:js购物车数量加减合计 编辑:程序博客网 时间:2024/06/11 05:57
[root@172 conf]# cat nginx.conf
user www;
worker_processes 4;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
pid logs/nginx.pid;
events {
use epoll;
worker_connections 35525;
}
http {
include mime.types;
default_type application/octet-stream;
#log日志全局格式
log_format access '$http_x_forwarded_for - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$request_time"';
server_tokens off;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 45;
#gzip on;
upstream epiao {
#ip_hash;
server 10.16.210.12:8080;
server 10.16.210.13:8080;
server 10.16.210.62:8080;
server 10.16.210.63:8080;
server 10.16.210.112:8080;
server 10.16.210.113:8080;
server 10.16.210.162:8080;
server 10.16.210.163:8080;
}
server {
listen 80 default_server;
server_name lcaolhosts;
location / {
autoindex on;
autoindex_exact_size on;
autoindex_localtime on;
add_header Access-Control-Allow-Origin *;
expires 10s;
}
location /status {
stub_status on;
access_log off;
allow 10.16.100.15;
allow 127.0.0.1;
deny all;
}
}
server {
listen 80 ;
server_name www.test.com;
#charset koi8-r;
#后端日志
access_log logs/piaotest.access.log access;
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 15m;
proxy_pass http://epiao;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 80 ;
server_name static.test.com;
#charset koi8-r;
#static静态日志
access_log logs/static.access.log access;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
upstream backend
{
server 172.16.230.200:9040;
}
#ssl认证
server {
listen 8081;
server_name localhosts;
#ssl on;
#ssl_certificate /app/nginx/conf/server.crt;
#ssl_certificate_key /app/nginx/conf/server.key;
#ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#ssl_ciphers HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM;
#ssl_prefer_server_ciphers on;
#ssl_session_cache shared:SSL:10m;
location / {
client_max_body_size 10m;
proxy_buffering off;
proxy_redirect http:// $scheme://;
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_pass http://backendtest;
}
location ~ .*\.(html|htm)$ {
root /app/nginx/html/pontus;
index index.html index.htm;
expires 1m;
}
location ~ .*\.(gif|jpg|jpeg|bmp|png|ico|txt|js|css)$ {
root /app/nginx/html/pontus;
index index.html index.htm;
expires 300d; }
}
}
user www;
worker_processes 4;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
pid logs/nginx.pid;
events {
use epoll;
worker_connections 35525;
}
http {
include mime.types;
default_type application/octet-stream;
#log日志全局格式
log_format access '$http_x_forwarded_for - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$request_time"';
server_tokens off;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 45;
#gzip on;
upstream epiao {
#ip_hash;
server 10.16.210.12:8080;
server 10.16.210.13:8080;
server 10.16.210.62:8080;
server 10.16.210.63:8080;
server 10.16.210.112:8080;
server 10.16.210.113:8080;
server 10.16.210.162:8080;
server 10.16.210.163:8080;
}
server {
listen 80 default_server;
server_name lcaolhosts;
location / {
autoindex on;
autoindex_exact_size on;
autoindex_localtime on;
add_header Access-Control-Allow-Origin *;
expires 10s;
}
location /status {
stub_status on;
access_log off;
allow 10.16.100.15;
allow 127.0.0.1;
deny all;
}
}
server {
listen 80 ;
server_name www.test.com;
#charset koi8-r;
#后端日志
access_log logs/piaotest.access.log access;
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 15m;
proxy_pass http://epiao;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 80 ;
server_name static.test.com;
#charset koi8-r;
#static静态日志
access_log logs/static.access.log access;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
upstream backend
{
server 172.16.230.200:9040;
}
#ssl认证
server {
listen 8081;
server_name localhosts;
#ssl on;
#ssl_certificate /app/nginx/conf/server.crt;
#ssl_certificate_key /app/nginx/conf/server.key;
#ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#ssl_ciphers HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM;
#ssl_prefer_server_ciphers on;
#ssl_session_cache shared:SSL:10m;
location / {
client_max_body_size 10m;
proxy_buffering off;
proxy_redirect http:// $scheme://;
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_pass http://backendtest;
}
location ~ .*\.(html|htm)$ {
root /app/nginx/html/pontus;
index index.html index.htm;
expires 1m;
}
location ~ .*\.(gif|jpg|jpeg|bmp|png|ico|txt|js|css)$ {
root /app/nginx/html/pontus;
index index.html index.htm;
expires 300d; }
}
}
0 0
- nginx配置参考2
- nginx.conf配置参考
- nginx配置参考1
- Nginx安全配置参考
- Nginx安全配置参考
- nginx.conf文件配置参考
- nginx 相关配置参考文章
- nginx+keepalived搭建配置参考
- nginx 配置详解参考链接
- [nginx] Nginx 反向代理完全配置参考
- mac下nginx配置,参考default
- 多主机nginx的配置参考
- 使用Nginx做邮件代理服务器配置(参考配置二)
- VPS Nginx + Tornado 的多站点配置参考
- nginx+php+mysql之rpm包方式安装配置参考
- Laravel 在 Nginx 中的参考配置两份
- nginx配置入门 详细出处参考:http://www.nginx.cn/591.html
- nginx websocket 参考
- 代码安全增强与标准注解语言SAL
- [Recovery]如何编译差分升级包
- 史上最详细测试用例设计实践-1:用例划分与设计
- 打包mysql、tomcat、jdk为一个软件
- HDU 5727 Necklace 2016多校第二场
- nginx配置参考2
- 关于flowPlay播放器
- 非阻塞套接字和epoll
- 思考:你的互联网+项目为何敏捷不起来?四、微服务与敏捷实施团队的拆分
- 使用webapck打包时如何使html中的图片也包含到包中
- 2016 Multi-University Training Contest 2-1001---HDU 5734 Acperience
- 每天一个(1):git config --global使用--持续更新
- 利用OpenCV的SimpleBlobDetector检测图像的奇异区域(斑点)
- linux 性能数据采集bash脚本