當前位置:
首頁 > 知識 > CentOS 配置 nginx 範例

CentOS 配置 nginx 範例

CentOS 配置 nginx 範例

目錄位置:/alidata/server/nginx-1.4.4/conf/vhosts

server {

listen 443 ssl;

server_name localhost;

ssl on;

ssl_certificate /alidata/server/nginx-1.4.4/conf/vhosts/www.gworg.com.pem;

ssl_certificate_key /alidata/server/nginx-1.4.4/conf/vhosts/www.gworg.com.key;

ssl_session_cache shared:SSL:1m;

ssl_session_timeout 5m;

ssl_ciphers HIGH:!aNULL:!MD5;

ssl_prefer_server_ciphers on;

location / {

root /alidata/www/default;

index index.html index.htm hello.php index.php;

}

location ~ .*.(php|php5)?$ {

location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$

{

expires 30d;

}

location ~ .*.(js|css)?$

{

expires 1h;

}

root /alidata/www/default;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param HTTPS on;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include fastcgi_params;

#new line

include fastcgi.conf;

}

}

server {

listen 80;

server_name www.hnphp.net;

rewrite ^(.*)$ https://$server_name$1 permanent;

index index.html index.htm index.php;

root /alidata/www/default;

location ~ .*.(php|php5)?$

{

#fastcgi_pass unix:/tmp/php-cgi.sock;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

include fastcgi.conf;

}

location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$

{

expires 30d;

}

location ~ .*.(js|css)?$

{

expires 1h;

}

#偽靜態規則

include /alidata/server/nginx/conf/rewrite/default.conf;

access_log /alidata/log/nginx/access/default.log;

}

喜歡這篇文章嗎?立刻分享出去讓更多人知道吧!

本站內容充實豐富,博大精深,小編精選每日熱門資訊,隨時更新,點擊「搶先收到最新資訊」瀏覽吧!


請您繼續閱讀更多來自 PHP愛好者 的精彩文章:

數字證書的作用和原理概述
Postfix 安裝SSL證書
Lighttpd SSL安裝文檔
ProFTPD 安裝SSL證書
MySQL 安裝SSL證書

TAG:PHP愛好者 |