Example of Nginx Configuring SSL (HTTPS) virtual hosts

Source: Internet
Author: User


Nginx configuration file 111cn.net.conf:

server {
Listen 80;
server_name 111cn.net;
Rewrite ^ (. *) $ https://$host $ 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 cookies $http _cookie;
Proxy_set_header X-real-ip $remote _addr;
Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;


Apache configuration file 111cn.net.conf:

<virtualhost *:88>
   documentroot/www/111cn.net
   ServerName 111cn.net
   php_admin_value open_basedir/www/111cn.net:/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/111cn.net>
    Options followsymlinks
    allowoverride all
 & nbsp;  order Allow,deny
    allow from all
</directory>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.