1. 程式人生 > >Ubuntu 14.0 搭建lnmp

Ubuntu 14.0 搭建lnmp

1. sudo apt-get update

2.sudo apt-get install nginx

3. sudo apt-get install php5-fpm

4.sudo apt-get install php5-mysql

5. vim  /etc/php5/fpm/pool.d/www.conf 看看裡面

 

Listen監聽的是什麼 結合nginx配置檔案fastcgi_pass修改 (如可能的值 /var/run/php5-fpm.sock,如果一樣就不需要修改)

在配置檔案里加上

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;

        }

}

6. /etc/init.d/php5-fpm restart   

   nginx  -s reload