CentOS 配置 nginx 范例

作者 : 开心源码 本文共1230个字,预计阅读时间需要4分钟 发布时间: 2022-05-12 共135人阅读

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;

}

说明
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是摆设,本站源码仅提供给会员学习使用!
7. 如遇到加密压缩包,请使用360解压,如遇到无法解压的请联系管理员
开心源码网 » CentOS 配置 nginx 范例

发表回复