1. 更新軟件源,新裝的系統(tǒng)需要使用一下這個命令
? ?sudo apt-get update?
2.安裝nginx
sudo apt-get install nginx
3. 安裝php5-fpm
sudo apt-get install php5-fpm
4. vim ?/etc/php5/fpm/pool.d/www.conf 看看里面
Listen監(jiān)聽的是什么 結合nginx配置文件fastcgi_pass修改 (如可能的值 /var/run/php5-fpm.sock,如果一樣就不需要修改)
在配置文件http那里加上
server {
listen?????? 80;
server_name? 你的域名;
root??"/var/www/web";
location / {
index? index.html index.htm index.php;
#autoindex? on;
if ( !-e $request_filename ){
rewrite (.*)$/index.php/$fastcgi_path_info;
}
}
location ~ \.php(.*)$ {
fastcgi_pass?? unix:/var/run/php5-fpm.sock;
fastcgi_index? index.php;
fastcgi_split_path_info? ^((?U).+\.php)(/?.+)$;
fastcgi_param? SCRIPT_FILENAME? $document_root$fastcgi_script_name;
fastcgi_param? PATH_INFO?$fastcgi_path_info;
fastcgi_param? PATH_TRANSLATED? $document_root$fastcgi_path_info;
include??????? fastcgi_params;
}
}
5. 重啟php-fpm 和nginx
/etc/init.d/php5-fpmrestart
nginx –s reload
因為數據庫使用的是阿里云rds,此處就不轉mysql了