一,安装Nginx
apt-get install Nginx
1,配置Nginx
Nginx所有的配置在/etc/Nginx/Nginx.conf中
include /etc/Nginx/conf.d/*.conf;
include /etc/Nginx/sites-enabled/*;
这两个配置,所以这里面的配置也是有效的。
这里我们把配置写在/etc/Nginx/sites-available/default中
location ~ \.PHP$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.PHP;
include fastcgi_params;
}
3,启动Nginx
/etc/init.d/Nginx start
4,在/usr/share/Nginx/html下新建index.PHP
<? PHP
PHPinfo();
?>
二 安装PHP
sudo apt-get install PHP5-fpm
sudo apt-get install PHP5-gd # Popular image manipulation library; used extensively by wordpress and it's plugins. sudo apt-get install PHP5-cli # Makes the PHP5 command available to the terminal for PHP5 scripting sudo apt-get install PHP5-curl # Allows curl (file downloading tool) to be called from PHP5 sudo apt-get install PHP5-mcrypt # Provides encryption algorithms to PHP scripts sudo apt-get install PHP5-MysqL # Allows PHP5 scripts to talk to a MysqL Database sudo apt-get install PHP5-readline # Allows PHP5 scripts to use the readline function 查看PHP5运行进程
ps -waux | grep PHP5 打开关闭PHP5进程
sudo service PHP5-fpm stop sudo service PHP5-fpm start sudo service PHP5-fpm restart sudo service PHP5-fpm status 配置PHP5监听端口 /etc/PHP5/fpm/pool.d/www.conf 把
listen = /var/run/PHP5-fpm.sock 改为
重新运行PHP进程 在浏览器中输入 localhost就可以看到了listen = 127.0.0.1:9000