首页 » 后端 » Apache » 正文

Nginx下SSL(https)虚拟主机配置示例

发布者:站点默认
2015/01/10 浏览数(2,036) 分类:Apache, Linux, Nginx Nginx下SSL(https)虚拟主机配置示例已关闭评论

Nginx 的配置文件 upall.cn.conf:

server {
   listen 80;
   server_name upall.cn;
   rewrite ^(.*)$ https://$host$1 permanent;
}
server {
   listen 443;
   server_name upall.cn;
   ssl on;
   ssl_certificate     /www/cert/upall.cn_bundle.crt;
   ssl_certificate_key /www/cert/upall.cn.key;

   root /www/upall.cn;
      index index.html index.php index.htm;
      location ~ \.php$ {
      proxy_pass http://127.0.0.1:88;
      include naproxy.conf;
   }
   location / {
      try_files $uri @apache;
   }
   location @apache {
      proxy_pass http://127.0.0.1:88;
      include naproxy.conf;
   }
   #error_page 497 https://$host$uri?$args;
}

naproxy.conf:

   proxy_connect_timeout 300s;
   proxy_send_timeout   900;
   proxy_read_timeout   900;
   proxy_buffer_size    32k;
   proxy_buffers        4 32k;
   proxy_busy_buffers_size 64k;
   proxy_redirect     off;
   proxy_hide_header  Vary;
   proxy_set_header   Accept-Encoding '';
   proxy_set_header   Host   $host;
   proxy_set_header   Referer $http_referer;
   proxy_set_header   Cookie $http_cookie;
   proxy_set_header   X-Real-IP  $remote_addr;
   proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;

Apache 的配置文件 upall.cn.conf:

<VirtualHost *:88>
   DocumentRoot /www/upall.cn
   ServerName upall.cn
   php_admin_value open_basedir /www/upall.cn:/tmp
   <IfModule mod_deflate.c>
      DeflateCompressionLevel 7
      AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-httpd-php
      AddOutputFilter DEFLATE css js html htm gif jpg png bmp php
   </IfModule>
</VirtualHost>
<Directory /www/upall.cn>
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

— 完 —

点击返回顶部
  1. 留言
  2. 联系方式