nginx 配置实例
来源:互联网 发布:面码仁太 知乎 编辑:程序博客网 时间:2024/06/16 04:13
支持部分页面SSL,整合apache的autoindex,支持fastcgi
[root@localhost ~]# cat /etc/nginx/nginx.conf user nginx;worker_processes 1;error_log /var/log/nginx/error.log warn;pid /var/run/nginx.pid;events { worker_connections 1024;}http { include /etc/nginx/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"'; log_format MySSL '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for" ' '"$ssl_cipher" "$ssl_protocol"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; keepalive_timeout 65; #gzip on; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_body_buffer_size 128k; proxy_connect_timeout 600; proxy_read_timeout 600; proxy_send_timeout 600; proxy_buffer_size 16k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k; 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; fastcgi_connect_timeout 300; fastcgi_read_timeout 300; fastcgi_send_timeout 300; fastcgi_buffer_size 64k; fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 128k; server { listen 80; listen 443 ssl; server_name localhost; ssl_certificate server.crt; ssl_certificate_key server.key; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; keepalive_timeout 70; #charset koi8-r; access_log /var/log/nginx/access.log MySSL; root /var/www/html; index index.html index.htm; #error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location / { if ( $https = on ) { return 301 http://$host$request_uri; } } location /certsrv { if ( $https != on ) { return 301 https://$host$request_uri; } autoindex on; autoindex_localtime on; } location /download { if ( $https = on ) { return 301 http://$host$request_uri; } proxy_pass http://localhost:8080; proxy_redirect http://localhost:8080/download http://$host$request_uri; } location ^~ /icons { if ( $https = on ) { return 301 http://$host$request_uri; } proxy_pass http://localhost:8080; proxy_redirect http://localhost:8080/icons http://$host$request_uri; location ~ \.(gif/png)$ { valid_referers none blocked server_names www.wjc.com wjc.com *.wjc.com; if ( $invalid_referer ) { return 403; } } } location ~ \.(php|php5)$ { if ( $https = on ) { return 301 http://$host$request_uri; } if ( !-e $request_filename ) { return 404; } fastcgi_pass unix:/dev/shm/php-fpm.socket; fastcgi_param SCRIPT_FILENAME $request_filename; include fastcgi_params; } }}[root@localhost ~]#
0 0
- nginx配置实例
- nginx rewrite 配置实例
- nginx虚拟主机配置实例
- Nginx常用配置实例
- Nginx + Keepalived 配置实例
- nginx配置实例
- Nginx配置虚拟主机实例
- nginx 配置实例
- Nginx配置实例
- Nginx虚拟主机配置实例(Nginx VirtualHost Example)
- Nginx服务器基础配置实例nginx.conf
- Nginx 负载均衡配置实例
- nginx配置rewrite实例【转】
- nginx伪静态配置实例
- Nginx 负载均衡配置实例
- Nginx负载均衡配置实例
- 04-Nginx配置服务器实例
- Nginx跳转的配置实例
- 根级别上的数据无效第1行位置1
- php at(@)符号的用法简介
- clang static analyzer源码分析(五)
- Intellij导入子项目时,maven列表子项目灰色不可用---解决方法
- 利用AbstractRoutingDataSource+注解实现动态数据源切换
- nginx 配置实例
- 根据不同的解决方案修改mfc的启动界面
- 使用 Spring Data JPA 简化 JPA 开发
- WebService学习总结(三)——使用JDK开发WebService
- css定位(position)
- POJ 2386
- 51nodoj 1240(莫比乌斯函数)
- 博客迁移至 GitHub Pages https://mummyding.github.io/
- hql与sql的区别