Lonely Dreamer (sanmai) wrote,
Lonely Dreamer
sanmai

phpMyAdmin + SSL + nginx + apache2

Nginx будет отвечать за SSL и статику:
server {
	set $www_root "/home/pma.example.com/www/htdocs";
	server_name pma.example.com;
   	listen pma.example.com:443;
    
	ssl on;
	ssl_certificate /home/pma.example.com/cert.pem;
	ssl_certificate_key /home/pma.example.com/privatekey.pem;
	#ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
	#ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
	ssl_session_cache shared:SSL:10m;

	location /scripts {
		internal;
	}

	location /libraries {
		internal;
	}

	location ~ /\.(ht|svn|git) {
		internal;
	}

	location ~* \.php$ {
		proxy_pass    http://apache;
	}

	location / {
		expires     60d;
		root $www_root;
		if (!-f $request_filename) {
			proxy_pass    http://apache;
		}
	}
}

Апач отвечает только за PHP:
<VirtualHost *:80>
	ServerName pma.example.com
	ServerAdmin webmaster@example.com

	DocumentRoot /home/pma.example.com/www/htdocs/
	<Directory /home/pma.example.com/www/htdocs/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>

	LogLevel warn
	ErrorLog /home/pma.example.com/www/logs/error.log
	CustomLog /home/pma.example.com/www/logs/access.log combined

	<IfModule itk.c>
		AssignUserID pma.example.com pma.example.com
		MaxClientsVHost 10
	</IfModule>

	SetEnv HTTPS on

	php_admin_value post_max_size "8M"
	php_admin_value upload_max_filesize "8M"
	php_admin_value session.gc_maxlifetime "14400"
</VirtualHost>
Дополнительно в /etc/apache2/ports.conf заменим:
Listen 80
на
Listen localhost:80
phpMyAdmin настраиваем по инструкции, cертификаты получаем в CAcert.org
Tags: apache2, linux, nginx, useful, vhosting
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments