Need help optimizing nginx to redirect from HTTP/80 to HTTPS/443

Mark Alan varia at
Sun Feb 22 14:55:39 MSK 2009

I am trying to optimize Nginx (Nginx/0.6.35 + Ubuntu 8.10) to redirect 
from HTTP/80 to HTTPS/443

I.e., any calls made to:
    http://pma.clinicacgm.0/ ,
should go into:

Could you review the bellow attached script and see if it can be optimized?

Thank you,


# --- cut here ---
# /etc/nginx/sites-available/spma
server {
	listen pma.clinicacgm.0:80;
	server_name pma.clinicacgm.0;
	# redirect phpmyadmin to the https page
	location / {
		# redirect to secure page [permanent | redirect]
		rewrite ^/(.*) https://pma.clinicacgm.0 permanent;
server {
	listen pma.clinicacgm.0:443;
	server_name pma.clinicacgm.0;

	access_log /var/log/nginx/pma.access.log;
	error_log /var/log/nginx/pma.error.log;

	#root /var/www/phpmyadmin;
	root /usr/share/phpmyadmin;

	location / {
		index index.php;
		include /etc/nginx/fastcgi_params;
		fastcgi_pass unix:/tmp/php-fastcgi.socket;
		fastcgi_index index.php;
		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
		fastcgi_param HTTPS on;

	gzip  off; # gzipping SSL encripted data is a waste of time
	ssl  on;
	ssl_certificate /etc/nginx/ssl/clinicacgm/server.crt;
	ssl_certificate_key /etc/nginx/ssl/clinicacgm/server.key;

# --- cut here ---

More information about the nginx mailing list