{"_id":"5a1db098b15d1b001ebc5f04","category":{"_id":"5a1db098b15d1b001ebc5ef4","version":"5a1db098b15d1b001ebc5ef2","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"},"user":"54e7ffdc6a7b0e2300d90d4c","project":"54e7fca9e6e77d1900ed11f0","parentDoc":null,"version":{"_id":"5a1db098b15d1b001ebc5ef2","project":"54e7fca9e6e77d1900ed11f0","__v":1,"createdAt":"2017-11-28T18:53:12.270Z","releaseDate":"2017-11-28T18:53:12.270Z","categories":["5a1db098b15d1b001ebc5ef3","5a1db098b15d1b001ebc5ef4","5a1db098b15d1b001ebc5ef5","5a1db098b15d1b001ebc5ef6"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"1.2.0","version":"1.2"},"githubsync":"","__v":1,"updates":["567b4e6b93919f0d00c97af3","58dc6623d82dc30f00572a7d","59f62a22af77790026fe7bdd","5b707d388f6b4a00038a9132"],"next":{"pages":[],"description":""},"createdAt":"2015-05-20T22:14:49.361Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":4,"body":"[block:api-header]\n{\n  \"title\": \"Generating the Configuration Automatically\"\n}\n[/block]\nIf the PufferPanel installer did not automatically create the needed configuration files for nginx, use the following commands as root to automatically generate them\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"cd /srv/pufferpanel\\n./pufferpanel nginx\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nOtherwise, follow the instructions below to manually create the configuration.\n[block:api-header]\n{\n  \"title\": \"Creating the Configuration Manually\"\n}\n[/block]\nThis 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/18.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.2-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.2-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.2-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

[block:api-header] { "title": "Generating the Configuration Automatically" } [/block] If the PufferPanel installer did not automatically create the needed configuration files for nginx, use the following commands as root to automatically generate them [block:code] { "codes": [ { "code": "cd /srv/pufferpanel\n./pufferpanel nginx", "language": "text" } ] } [/block] Otherwise, follow the instructions below to manually create the configuration. [block:api-header] { "title": "Creating the Configuration Manually" } [/block] 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/18.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.2-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.2-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.2-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]