User Tools

Site Tools


Sidebar

linux:nginx:vhost-with-forced-ssl.conf

server {
       listen         80;
       server_name    <<DOMAIN>>;
       return         301 https://$server_name$request_uri;
}

server {
	listen 443;
	server_name <<DOMAIN>>;

	root <<PATH-TO-HTML-FILES>>;
	index index.html index.html index.php;

	ssl on;
	ssl_certificate <<PATH-TO-SSL-CERT>>;
	ssl_certificate_key <<PATH-TO-SSL-KEY>>;

	include global/ssl.conf;

	location / {
		try_files $uri $uri/ =404;
	}

	location ~ \.php$ {
                # With php5-fpm:
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
	}

	include global/restrictions.conf
}

linux/nginx/vhost-with-forced-ssl.conf.txt · Last modified: 2014/12/02 10:40 (external edit)