nginx https配置|Nginx配置SSL(https)虚拟主机的例子

更新时间:2019-11-01    来源:nginx    手机版     字体:

【www.bbyears.com--nginx】


Nginx 的配置文件 111cn.net.conf:

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

   root /www/111cn.net;
      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 的配置文件 111cn.net.conf:


   DocumentRoot /www/111cn.net
   ServerName 111cn.net
   php_admin_value open_basedir /www/111cn.net:/tmp
  
      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
  



    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all

本文来源:http://www.bbyears.com/caozuoxitong/76681.html