Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## redirect from http to https
- server {
- listen 80 default_server;
- server_name site.example.com
- www.example.com
- example.com;
- rewrite ^ https://$server_name$request_uri? permanent;
- }
- ### HTTPS
- server {
- listen 443 ssl default_server;
- ssl on;
- ssl_certificate /etc/nginx/cert/_.example.com-chained.pem;
- ssl_certificate_key /etc/nginx/cert/_.example.com.key.insecure;
- ssl_session_timeout 15m;
- ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
- ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
- ssl_prefer_server_ciphers on;
- allow all;
- server_name site.example.com _;
- root /usr/share/nginx/www/site.example.com/public_html;
- index index.php index.html index.htm;
- ###################################################
- ### this is the configuration that fixed my problem
- if ($host !~* ^site\.) {
- return 301 https://site.example.com$request_uri$is_args$args;
- }
- ###################################################
- ###################################################
- access_log /var/log/nginx/site.example.com.access.log;
- error_log /var/log/nginx/site.example.com.error.log debug;
- ### enable php scripts
- location ~ \.php$ {
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- include fastcgi_params;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- }
- ###
- }
- ### END OF HTTPS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement