一,安裝Nginx apt-get install nginx 1,配置nginx nginx所有的配置在 /etc/nginx/nginx.conf中 nginx.conf配置里面包括了 include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; 這兩個(gè)配置,所以這里面的配置也是有效的。 錯(cuò)誤日志 error_log /var/log/nginx/error.log; 這里我們把配置寫在 /etc/nginx/sites-available/default中 修改 root /usr/share/nginx/html; 這是網(wǎng)頁(yè)的根目錄,默認(rèn)里面有一個(gè)index.html頁(yè)面 index index.html index.htm修改成index index.php index.html index.htm; 增加 location ~ \.php$ { try_files $uri =404; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; } 2,保存文件,使配置生效 /etc/init.d/nginx reload 3,啟動(dòng)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 ps -waux | grep php5 sudo service php5-fpm stop sudo service php5-fpm start sudo service php5-fpm restart sudo service php5-fpm status
|
|