Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Need help w SSL setup

$
0
0
Trying to get SSL setup properly. Can someone verify I'm doing this correctly? These config files work.. Below works.. but I am required to push all traffic through SSL. Would like to be able to selectively have http and https traffic on my site. Any suggestions greatly appreciated!




[mywebsite.com] config file
----
server {
server_name mywebsite.com mywebsite.org;
rewrite ^/(.*) http://www.mywebsite.org/$1 permanent;
}

server {
listen 80;
client_max_body_size 5M;
server_name www.mywebsite.org *.mywebsite.org;
access_log /srv/www/mywebsite.org/logs/access.log;
error_log /srv/www/mywebsite.org/logs/error.log;
root /srv/www/mywebsite.org/public_html;
fastcgi_index index.php;

location / {
root /srv/www/mywebsite.org/public_html;
index index.html index.htm index.php;
}

location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/mywebsite.org/public_html$fastcgi_script_name;
}
}


[ssl.mywebsite.com] config file
---------


server {
server_name mywebsite.com mywebsite.org www.mywebsite.org www.mywebsite.com;
rewrite ^/(.*) https://www.mywebsite.org/$1 permanent;
}


server {
ssl on;
ssl_certificate /srv/ssl/mywebsite.combined.crt;
ssl_certificate_key /srv/ssl/mywebsite.org.key;
listen 443;
client_max_body_size 5M;
server_name www.mywebsite.org *.mywebsite.org;
access_log /srv/www/mywebsite.org/logs/access.log;
error_log /srv/www/mywebsite.org/logs/error.log;
root /srv/www/mywebsite.org/public_html;
fastcgi_index index.php;

location / {
root /srv/www/mywebsite.org/public_html;
index index.html index.htm index.php;
}

location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param HTTPS on;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/mywebsite.org/public_html$fastcgi_script_name;
}
}

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>