nginx配置模板

[code="java"]# cd conf/
# ll
总用量 36
drwxr-xr-x. 2 richmail richmail 4096 2月 4 19:31 conf.d
-rwxr-xr-x. 1 richmail richmail 2837 2月 3 23:25 koi-utf
-rwxr-xr-x. 1 richmail richmail 2223 2月 3 23:25 koi-win
-rwxr-xr-x. 1 richmail richmail 3463 2月 3 23:25 mime.types
-rwxr-xr-x. 1 richmail richmail 2710 2月 3 17:40 nginx.conf
-rwxr-xr-x. 1 richmail richmail 1675 2月 3 23:25 privkey.pem
-rwxr-xr-x. 1 richmail richmail 4412 2月 3 23:25 server.pem
-rwxr-xr-x. 1 richmail richmail 3610 2月 3 23:25 win-utf
# less nginx.conf
user richmail richmail;
#worker_processes 4;
#worker_cpu_affinity 0001 0010 0100 1000;
worker_rlimit_nofile 65535;
pid /home/richmail/nginx/logs/nginx.pid;

events {
use epoll;
worker_connections 256;
}

http {
include mime.types;
default_type application/octet-stream;
server_tokens off;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
sendfile on;
tcp_nopush on;
keepalive_timeout 30;
tcp_nodelay on;
log_format acc '$remote_addr - $remote_user [$time_local] "$request" '
'$status $upstream_response_time $body_bytes_sent "$http_referer" "$sent_http_location"'
'"$http_user_agent" "$http_x_forwarded_for"';
gzip on;
gzip_comp_level 2;
gzip_http_version 1.1;
gzip_types text/plain application/x-javascript text/css application/xml text/javascript;
gzip_proxied any;
gzip_vary on;

proxy_cache_path /home/richmail/nginx/cache levels=1:2 keys_zone=tmp_cache:1024m inactive=20m max_size=1024m;
#proxy_set_header X-Forwarded-Proto https;
add_header X-Frame-Options SAMEORIGIN;
#add_header Cache-Control no-store;

server {
listen 80;
server_name _;
access_log /home/richmail/logs/xx.nginx.log acc;
error_log /home/richmail/logs/xx.nginx.err info;
root /home/richmail/nginx/html;
proxy_intercept_errors on;
error_page 500 /error.html;
error_page 404 /404.html;
user richmail richmail;
#worker_processes 4;
#worker_cpu_affinity 0001 0010 0100 1000;
worker_rlimit_nofile 65535;
pid /home/richmail/nginx/logs/nginx.pid;

events {
use epoll;
worker_connections 256;
}

http {
include mime.types;
default_type application/octet-stream;
server_tokens off;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
sendfile on;
tcp_nopush on;
keepalive_timeout 30;
tcp_nodelay on;
log_format acc '$remote_addr - $remote_user [$time_local] "$request" '
'$status $upstream_response_time $body_bytes_sent "$http_referer" "$sent_http_location"'
'"$http_user_agent" "$http_x_forwarded_for"';
gzip on;
gzip_comp_level 2;
gzip_http_version 1.1;
gzip_types text/plain application/x-javascript text/css application/xml text/javascript;
gzip_proxied any;
gzip_vary on;

proxy_cache_path /home/richmail/nginx/cache levels=1:2 keys_zone=tmp_cache:1024m inactive=20m max_size=1024m;
#proxy_set_header X-Forwarded-Proto https;
add_header X-Frame-Options SAMEORIGIN;
#add_header Cache-Control no-store;

server {
listen 80;
server_name _;
access_log /home/richmail/logs/xx.nginx.log acc;
error_log /home/richmail/logs/xx.nginx.err info;
root /home/richmail/nginx/html;
proxy_intercept_errors on;
error_page 500 /error.html;
error_page 404 /404.html;
error_page 404 /404.html;
}

server {
listen 80;
server_name webnote.com 127.0.0.1 192.168.34.92;
access_log /home/richmail/logs/mail.nginx.log acc;
error_log /home/richmail/logs/mail.nginx.err info;
proxy_intercept_errors on;
error_page 500 502 503 504 /error.html;
error_page 404 /404.html;
error_page 403 =404 /forbidden.gif;
if ($request_method !~* GET|HEAD|POST) {
return 400;
}
include conf.d/note.conf;
}
server {
listen 443;
server_name webnote.com 127.0.0.1 192.168.34.92;
access_log /home/richmail/logs/mailssl.nginx.log acc;
error_log /home/richmail/logs/mailssl.nginx.err info;
proxy_intercept_errors on;
error_page 500 502 503 504 /error.html;
error_page 404 /404.html;
error_page 403 =404 /forbidden.gif;
if ($request_method !~* GET|HEAD|POST) {
return 400;
}
add_header Cache-Control no-store;
add_header Pragma: no-cache;
ssl on;
ssl_certificate server.pem;
ssl_certificate_key privkey.pem;
include conf.d/note.conf;
}
}[/code]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值