Created
December 12, 2019 04:23
-
-
Save aamsur-mkt/bdf26d703722a7e7448707734410b218 to your computer and use it in GitHub Desktop.
Phalcon Nginx Configuration Example
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 { | |
| listen 80; | |
| server_name api-phalcon.aam; | |
| index index.php; | |
| root /home/aamsur/workspace/api-phalcon/public; | |
| access_log /var/log/nginx/api-phalcon.aam.access.log; | |
| error_log /var/log/nginx/api-phalcon.aam.error.log warn; | |
| charset utf-8; | |
| location / { | |
| # Matches URLS `$_GET['_url']` | |
| try_files $uri $uri/ /index.php?_url=$uri&$args; | |
| } | |
| # When the HTTP request does not match the above | |
| # and the file ends in .php | |
| location ~ [^/]\.php(/|$) { | |
| # try_files $uri =404; | |
| # Ubuntu and PHP7.0-fpm in socket mode | |
| # This path is dependent on the version of PHP install | |
| fastcgi_pass unix:/run/php/php7.2-fpm.sock; | |
| # Alternatively you use PHP-FPM in TCP mode (Required on Windows) | |
| # You will need to configure FPM to listen on a standard port | |
| # https://www.nginx.com/resources/wiki/start/topics/examples/phpfastcgionwindows/ | |
| # fastcgi_pass 127.0.0.1:9000; | |
| fastcgi_index /index.php; | |
| include fastcgi_params; | |
| fastcgi_split_path_info ^(.+?\.php)(/.*)$; | |
| if (!-f $document_root$fastcgi_script_name) { | |
| return 404; | |
| } | |
| fastcgi_param PATH_INFO $fastcgi_path_info; | |
| # fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; | |
| # and set php.ini cgi.fix_pathinfo=0 | |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
| } | |
| location ~ /\.ht { | |
| deny all; | |
| } | |
| location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
| expires max; | |
| log_not_found off; | |
| access_log off; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment