-
-
Save msonowal/e2886a3e00082fbecc3dfc2343f9d4f7 to your computer and use it in GitHub Desktop.
NGINX config for PageKit. (Tested on Ubuntu) (If for some reason I don't reply to a comment leave a message at https://darryldias.me/contact/)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| server { | |
| # Server name | |
| server_name example.com; | |
| # Server Port | |
| listen 80; | |
| # Webroot | |
| root /var/www/; | |
| # Index file | |
| index index.php; | |
| # PHP setup with query string support | |
| location / { | |
| try_files $uri $uri/ /index.php?$args; | |
| } | |
| # Deny access to sensitive folders | |
| location ~* /(packages|storage|tmp)/.*$ { | |
| return 403; | |
| } | |
| # Deny access to files with the following extensions | |
| location ~* \.(db|json|lock|dist|md)$ { | |
| return 403; | |
| } | |
| # Deny access to following files | |
| location ~ /(config.php|pagekit|composer.lock|composer.json|LICENSE|\.htaccess) { | |
| return 403; | |
| } | |
| # Leverage browser caching of media files for 30 days | |
| location ~* \.(?:ico|css|js|gif|jpe?g|png|ttf|woff)$ { | |
| access_log off; | |
| expires 30d; | |
| add_header Pragma public; | |
| add_header Cache-Control "public, mustrevalidate, proxy-revalidate"; | |
| } | |
| # Uncomment the lines below depending on the PHP version you are using. | |
| # PHP-FPM settings for PHP 7 | |
| # location ~ \.php$ { | |
| # try_files $uri =404; | |
| # fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; | |
| # fastcgi_index index.php; | |
| # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
| # include fastcgi_params; | |
| # fastcgi_param HTTP_MOD_REWRITE On; | |
| # } | |
| # PHP-FPM settings for PHP 5 | |
| # location ~ \.php$ { | |
| # try_files $uri =404; | |
| # fastcgi_pass unix:/var/run/php5-fpm.sock; | |
| # fastcgi_index index.php; | |
| # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
| # include fastcgi_params; | |
| # fastcgi_param HTTP_MOD_REWRITE On; | |
| # } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment