OSChina 的 Nginx 配置資訊
user nobody;
worker_processes 2;
#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 4096;
}
http {
include mime.types;
default_type application/octet-stream;
server_tokens off;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
limit_zone one $binary_remote_addr 10m;
include gzip.conf;
server {
listen 80;
server_name localhost;
location / {
#rewrite (.*) permanent;
deny all;
}
location ~ ^/NginxStatus {
stub_status on;
access_log off;
allow 127.0.0.1;
allow 219.136.242.37;
allow 192.168.2.0/24;
deny all;
}
}
server {
listen 80;
server_name m.oschina.net my.oschina.net;
log_format oschina_log
'$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/oschina.log;
location ~ ^/NginxStatus {
stub_status on;
access_log off;
auth_basic "valid-user";
auth_basic_user_file /opt/ngx/conf/oschina_pw;
}
location ~ ^/mrtg {
auth_basic "valid-user";
auth_basic_user_file /opt/ngx/conf/oschina_pw;
access_log off;
root /opt/mrtg;
}
location ~ ^/awstats/ {
root /data/oschina/webapp;
access_log off;
error_log off;
auth_basic "valid-user";
auth_basic_user_file /opt/ngx/conf/oschina_pw;
}
location ~ ^/(WEB-INF)/ {
deny all;
}
location ~ ^/uploads/ {
root /data/oschina/webapp;
expires 24h;
valid_referers none blocked *.google.com *.qq.com *.oschina.net *.csdn.net *.gzv8.com;
if ($invalid_referer){
rewrite ^/ http:///img/logo.gif;
}
}
location ~ \.(htm|html|gif|jpg|jpeg|png|ico|rar|css|js|zip|txt|flv|swf|doc|ppt|xls|pdf)$ {
root /data/oschina/webapp;
access_log off;
expires 24h;
}
location / {
proxy_pass
include proxy.conf;
}
error_page 502 503 /502.html;
error_page 404 /404.html;
error_page 403 /403.html;
}
}
|
[2].[程式碼] proxy.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
|
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;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
|
[3].[程式碼] gzip.conf
1
2
3
|
gzip on;
gzip_min_length 1000;
gzip_types text/plain text/css application/x-javascript;
|
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/196700/viewspace-2103958/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- nginx的配置Nginx
- nginx location 的配置Nginx
- 配置nginxNginx
- Nginx 配置Nginx
- nginx配置Nginx
- Nginx之(三)Nginx配置Nginx
- Nginx的跨域配置Nginx跨域
- Nginx 支援websocket的配置NginxWeb
- Nginx的各種配置Nginx
- nginx之 nginx限流配置Nginx
- Nginx篇--解讀nginx配置Nginx
- [轉]Nginx 配置檔案nginx.conf的完整配置說明Nginx
- Docker配置nginxDockerNginx
- nginx常用配置Nginx
- nginx代理配置Nginx
- Nginx Location 配置Nginx
- NGINX基本配置Nginx
- Nginx 配置域名Nginx
- Nginx部署配置Nginx
- Nginx - 最小配置Nginx
- nginx location配置Nginx
- nginx 配置使用Nginx
- thinkphp nginx 配置PHPNginx
- nginx配置404Nginx
- 配置nginx支援Nginx
- 【Nginx】Referer配置Nginx
- ThinkPHP 的 nginx 配置踩坑PHPNginx
- nginx配置gzip中的坑Nginx
- NGINX的配置和基本使用Nginx
- saltstack之nginx、php的配置NginxPHP
- 配置nginx對php的支援NginxPHP
- nginx的port_in_redirect配置Nginx
- 我的Nginx配置檔案Nginx
- nginx的編譯和配置Nginx編譯
- Nginx的安裝配置使用Nginx
- Nginx安全配置研究Nginx
- nginx配置轉發Nginx
- Nginx日誌配置Nginx