Install Nginx
Install PHP
The code is as follows: |
Copy code |
Sudo apt-get install php5-cli php5-cgi php5-fpm php5-mcryp |
Modify Nginx configuration
The code is as follows: |
Copy code |
Server { # Listen 80; # listen for ipv4; this line is default and implied # Listen [:]: 80 default ipv6only = on; # listen for ipv6 # Root/usr/share/nginx/www; Root/path/to/your/project; Index index.html index.htm index. php; # Make site accessible from http: // localhost/ Server_name localhost; Location /{ # First attempt to serve request as file, then # As directory, then fall back to index.html Try_files $ uri // index.html; # Uncomment to enable naxsi on this location # Include/etc/nginx/naxsi. rules } Location ~ . Php $ { Fastcgi_split_path_info ^ (. +. php) (/. +) $; # NOTE: You shoshould have "cgi. fix_pathinfo = 0;" in php. ini # # With php5-cgi alone: Fastcgi_pass 127.0.0.1: 9000; # With php5-fpm: # Fastcgi_pass unix:/var/run/php5-fpm.sock; Fastcgi_index index. php; Include fastcgi_params; } } |