Installing Nginx
sudo apt-get install nginx
Test Nginx
Open the browser, enter http://127.0.0.1, if it appears
Indicates that the Nginx installation was successful.
Install config PHP
InstallationPHP for Processing
sudo apt-get install php5-fpm php5-mysql
Since Nginx does not contain native PHP processing like some other Web servers, we'll need to install PHP5-FPM, which St ANDs for "FastCGI process Manager". We'll tell the Nginx to pass PHP requests to this software for processing.
We can install this module and would also grab an additional helper package that would allow PHP to communicate with our DAT Abase backend. The installation would pull in the necessary PHP core files. Do the by typing:
ConfigurationPHP Processor
sudo gedit /etc/php5/fpm/php.ini
cgi.fix_pathinfo=0
This was an extremely insecure setting because it tells PHP to attempt to execute the closest file it can find if a php fil E does not match exactly. This basically would allow users to craft PHP requests in a a-to-would allow them-execute scripts that they shouldn ' t is allowed to execute.
We'll change both of these conditions by uncommenting the line and setting it to "0" like this:
Save and close the file is finished.
RestartPHP processor
sudo service php5-fpm restart
Let Nginx usePHP Processor
sudo gedit /etc/nginx/sites-available/default
Modify the configuration file as follows
server { listen 80 default_server; listen [::]:80 default_server ipv6 root /usr/share/nginx/html; index index.php index.html index.htm; server_name server_domain_name_or_IP; location / { try_files $uri $uri/ =404; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }}
Make the configuration of PHP effective immediately
sudo service nginx restart
Build a test page
sudo gedit /usr/share/nginx/html/info.php
The contents are:
phpinfo();?>
Accesshttp://127.0.0.1/info.php
If it appears
Indicates that the configuration was successful
Resources
https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-14-04
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
The above describes the Ubuntu installation Nginx, PHP, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.