nginx的配置
lnmpa的環境。
[root@abc conf]# vi /usr/local/nginx/nginx.conf
gzip_vary on;
gzip_types
text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
text/javascript application/javascript application/x-javascript
text/x-json application/json application/x-web-app-manifest+json
text/css text/plain text/x-component
font/opentype application/x-font-ttf application/vnd.ms-fontobject
image/x-icon;
gzip_disable "MSIE [1-6].(?!.*SV1)";
#If you have a lot of static files to serve through Nginx then caching of the files` metadata (not the actual files` contents) can save some latency.
open_file_cache max=1000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
######################## default ############################
server {
listen 80;
server_name _;
access_log /data/wwwlogs/access_nginx.log combined;
root /data/wwwroot/www.***.com/public;
index index.html index.htm index.php;
#error_page 404 /404.html;
#error_page 502 /502.html;
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
location / {
try_files $uri @apache;
}
location @apache {
proxy_pass http://127.0.0.1:88;
include proxy.conf;
}
location ~ [^/].php(/|$) {
proxy_pass http://127.0.0.1:88;
include proxy.conf;
}
location ~ .*.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
expires 30d;
access_log off;
}
location ~ .*.(js|css)?$ {
expires 7d;
access_log off;
}
location ~ /.ht {
deny all;
}
}
########################## vhost #############################
include vhost/*.conf;
}
[root@abc vhost]# vi /usr/local/nginx/conf/vhost/www.***.com.conf
server {
listen 443;
#listen 80;
ssl on;
server_name www.***.com;
ssl_certificate ../cert/21234224312342.pem;
ssl_certificate_key ../cert/21234224312342.key;
ssl_session_timeout 5m;
ssl_ciphers ABCDE-ABC-AES128-ABC-SHA256:ABCDE:ABCD:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
access_log off;
index index.html index.htm index.php;
root /data/wwwroot/www.***.com/public;
location / {
try_files $uri @apache;
}
location @apache {
proxy_pass http://127.0.0.1:88;
include proxy.conf;
}
location ~ .*.(php|php5|cgi|pl)?$ {
proxy_pass http://127.0.0.1:88;
include proxy.conf;
}
location ~ .*.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
expires 30d;
access_log off;
}
location ~ .*.(js|css)?$ {
expires 7d;
access_log off;
}
location ~ /.ht {
deny all;
}
}
[root@abc vhost]# vi /usr/local/apache/conf/vhost/www.***.com.conf
<VirtualHost *:88>
ServerAdmin admin@example.com
DocumentRoot "/data/wwwroot/www.***.com/public"
ServerName www.***.com
ErrorLog "/data/wwwlogs/www.***.com_error_apache.log"
CustomLog "/dev/null" common
<Directory "/data/wwwroot/www.***.com/public">
SetOutputFilter DEFLATE
Options FollowSymLinks ExecCGI
Require all granted
AllowOverride All
Order allow,deny
Allow from all
DirectoryIndex index.html index.php
</Directory>
</VirtualHost>
本文轉自phpervip 51CTO部落格,原文連結:
http://blog.51cto.com/phpervip/2051206,如需轉載請自行聯絡原作者
相關文章
- 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
- OSChina 的 Nginx 配置資訊Nginx
- nginx的編譯和配置Nginx編譯
- Nginx的安裝配置使用Nginx
- Nginx安全配置研究Nginx
- nginx配置轉發Nginx
- Nginx日誌配置Nginx