server {
listen 80;
server_name {{ username }}.loc {{ domains }};
error_log /home/{{ username }}/logs/nginx-error.log warn;
gzip on;
gzip_comp_level 5;
gzip_disable "msie6";
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_redirect http://127.0.0.1:8080 /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_connect_timeout {{ max_execution_time }};
proxy_send_timeout {{ max_execution_time }};
proxy_read_timeout {{ max_execution_time }};
}
location ~* \.(jpg|jpeg|gif|png|ico|css|bmp|swf|js|txt|woff)$ {
root /home/{{username}}/www/{{ document_root }};
expires max;
}
location /.well-known/acme-challenge {
root /usr/share/nginx/html;
try_files $uri $uri/ =404;
}
client_max_body_size {{ max_filesize }}M;
}
<VirtualHost 127.0.0.1:8080>
ServerName {{ username }}.loc
ServerAlias {{ domains }}
# ServerAlias example.*.xip.io
DocumentRoot /home/{{ username }}/www/{{ document_root }}
<Directory /home/{{ username }}/www/{{ document_root }}>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
<FilesMatch \.php$>
# 2.4.10+ can proxy to unix socket
SetHandler "proxy:unix:/var/run/php/php{{ php }}-fpm-{{ username }}.sock|fcgi://localhost/"
# Else we can just use a tcp socket:
# SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>
ErrorLog ${APACHE_LOG_DIR}/{{ username }}-error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
# CustomLog ${APACHE_LOG_DIR}/example.com-access.log combined
</VirtualHost>
[{{ username }}]
user = {{ username }}
group = {{ username }}
listen = /var/run/php/php{{ php }}-fpm-{{ username }}.sock
listen.owner = www-data
listen.group = www-data
pm = ondemand
pm.max_children = 5
chdir = /
php_admin_value[memory_limit] = {{ memory_limit }}M
php_admin_value[max_execution_time] = {{ max_execution_time }}
php_admin_value[upload_max_filesize] = {{ max_filesize }}M
php_admin_value[post_max_size] = {{ max_filesize }}M
php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f {{ email }}
php_admin_value[error_log] = /home/{{ username }}/logs/fpm-php.log
php_admin_value[upload_tmp_dir] = /home/{{ username }}/tmp
php_admin_value[soap.wsdl_cache_dir] = /home/{{ username }}/tmp
{{ php_config }}
php_admin_value[date.timezone] = UTC
php_admin_value[disable_functions] = system,proc_open,popen,curl_multi_exec,parse_ini_file,show_source,stream_set_write_buffer,stream_socket_sendto,com_load_typelib