{"_id":"58fe142d180afa25006c797c","user":"54e7ffdc6a7b0e2300d90d4c","project":"54e7fca9e6e77d1900ed11f0","__v":0,"parentDoc":null,"version":{"_id":"58fe142d180afa25006c7974","project":"54e7fca9e6e77d1900ed11f0","__v":2,"createdAt":"2017-04-24T15:05:17.571Z","releaseDate":"2017-04-24T15:05:17.571Z","categories":["58fe142d180afa25006c7975","58fe142d180afa25006c7976","58fe142d180afa25006c7977","58fe142d180afa25006c7978","591f725ffc05d30f00488267"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"1.1.0","version":"1.1"},"category":{"_id":"58fe142d180afa25006c7976","version":"58fe142d180afa25006c7974","project":"54e7fca9e6e77d1900ed11f0","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-04-25T01:54:38.235Z","from_sync":false,"order":1,"slug":"tutorials","title":"Tutorials"},"updates":["567b4e6b93919f0d00c97af3","58dc6623d82dc30f00572a7d"],"next":{"pages":[],"description":""},"createdAt":"2015-05-20T22:14:49.361Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":4,"body":"This documentation will assume you have nginx installed. If you do not, please consult [nginx's documentation](https://www.nginx.com/l) on how to install.\n\nYou will need to locate where your nginx server configs are (generally */etc/nginx*). In there, will be either a *conf.d* or a *sites-enabled* folder. In one of those folders, create a *pufferpanel.conf* file and add the following (replacing panel.examplehost.com with the IP address or domain to access the panel on).\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"This configuration assumes that you have PHP listening using a unix socket. Most configurations will default to using a socket, although some configure it with a TCP connection. To determine if this is the case run the command below.\\n\\nCentOS: `grep '^listen *=' /etc/php-fpm.d/www.conf`\\nUbuntu 14.04: `grep '^listen *=' /etc/php5/fpm/pool.d/www.conf`\\nUbuntu 16.04: `grep '^listen ='  /etc/php/*/fpm/pool.d/www.conf\\n\\n Should this be `127.0.0.1:9000`, you should replace the `unix:/var/run/php/php7.0-fpm.sock` below with `127.0.0.1:9000;`\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"server {\\n    listen 80;\\n    root /srv/pufferpanel/;\\n    index index.php;\\n    \\n    server_name panel.examplehost.com;\\n\\n    client_max_body_size 20m;\\n    client_body_timeout 120s;\\n\\n    location / {\\n        try_files /public/router.php =404;\\n        fastcgi_split_path_info ^(.+?\\\\.php)(/.*)$;\\n        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;\\n        fastcgi_index router.php;\\n        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\\n        include /etc/nginx/fastcgi_params;\\n    }\\n\\n    location /assets {\\n        try_files /app/$uri =404;\\n    }\\n\\n}\\n\\n#server {\\n#    listen 443;\\n#    root /srv/pufferpanel/;\\n#    index index.php;\\n#\\n#    server_name panel.examplehost.com;\\n#\\n#    ssl on;\\n#    ssl_certificate     /etc/nginx/ssl/<server>.crt;\\n#    ssl_certificate_key /etc/nginx/ssl/<server>.key;\\n#\\n#    location / {\\n#        try_files /public/router.php =404;\\n#        fastcgi_split_path_info ^(.+?\\\\.php)(/.*)$;\\n#        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;\\n#        fastcgi_index router.php;\\n#        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\\n#        include /etc/nginx/fastcgi_params;\\n#    }\\n#\\n#    location /assets {\\n#        try_files /app/$uri =404;\\n#    }\\n\\n\",\n      \"language\": \"shell\",\n      \"name\": \"pufferpanel.conf\"\n    }\n  ]\n}\n[/block]\n\nAfterwards, use `service nginx restart` to restart nginx and apply this change.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"This file does not permit HTTPS access to your panel directly. If you wish to use HTTPS, uncomment the second server block and point the ssl_certificate and ssl_certificate_key to those for your server. If you use Cloudflare for HTTPS support, this should not be uncommented.\"\n}\n[/block]","excerpt":"Configuring an nginx server for Pufferpanel support","slug":"nginx-configuration","type":"basic","title":"nginx Configuration"}

nginx Configuration

Configuring an nginx server for Pufferpanel support

This documentation will assume you have nginx installed. If you do not, please consult [nginx's documentation](https://www.nginx.com/l) on how to install. You will need to locate where your nginx server configs are (generally */etc/nginx*). In there, will be either a *conf.d* or a *sites-enabled* folder. In one of those folders, create a *pufferpanel.conf* file and add the following (replacing panel.examplehost.com with the IP address or domain to access the panel on). [block:callout] { "type": "info", "body": "This configuration assumes that you have PHP listening using a unix socket. Most configurations will default to using a socket, although some configure it with a TCP connection. To determine if this is the case run the command below.\n\nCentOS: `grep '^listen *=' /etc/php-fpm.d/www.conf`\nUbuntu 14.04: `grep '^listen *=' /etc/php5/fpm/pool.d/www.conf`\nUbuntu 16.04: `grep '^listen =' /etc/php/*/fpm/pool.d/www.conf\n\n Should this be `127.0.0.1:9000`, you should replace the `unix:/var/run/php/php7.0-fpm.sock` below with `127.0.0.1:9000;`" } [/block] [block:code] { "codes": [ { "code": "server {\n listen 80;\n root /srv/pufferpanel/;\n index index.php;\n \n server_name panel.examplehost.com;\n\n client_max_body_size 20m;\n client_body_timeout 120s;\n\n location / {\n try_files /public/router.php =404;\n fastcgi_split_path_info ^(.+?\\.php)(/.*)$;\n fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;\n fastcgi_index router.php;\n fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n include /etc/nginx/fastcgi_params;\n }\n\n location /assets {\n try_files /app/$uri =404;\n }\n\n}\n\n#server {\n# listen 443;\n# root /srv/pufferpanel/;\n# index index.php;\n#\n# server_name panel.examplehost.com;\n#\n# ssl on;\n# ssl_certificate /etc/nginx/ssl/<server>.crt;\n# ssl_certificate_key /etc/nginx/ssl/<server>.key;\n#\n# location / {\n# try_files /public/router.php =404;\n# fastcgi_split_path_info ^(.+?\\.php)(/.*)$;\n# fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;\n# fastcgi_index router.php;\n# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n# include /etc/nginx/fastcgi_params;\n# }\n#\n# location /assets {\n# try_files /app/$uri =404;\n# }\n\n", "language": "shell", "name": "pufferpanel.conf" } ] } [/block] Afterwards, use `service nginx restart` to restart nginx and apply this change. [block:callout] { "type": "info", "body": "This file does not permit HTTPS access to your panel directly. If you wish to use HTTPS, uncomment the second server block and point the ssl_certificate and ssl_certificate_key to those for your server. If you use Cloudflare for HTTPS support, this should not be uncommented." } [/block]