Need help w SSL setup
April 26, 2013 09:55AM
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;
}
}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 104
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready