1. 程式人生 > >ubuntu apt-get 安裝 nginx+php+mysql

ubuntu apt-get 安裝 nginx+php+mysql

$ apt-get install php5-dev php5-cli php5-fpm php5-cgi php5-mysql mysql-server 測試 1.修改Nginx預設伺服器預設主目錄的擁有者,並把自己加入到www-data組 $ cd /usr/share/nginx $ sudo chown -R www-data:www-data ./html/ $ sudo chmod -R g+w ./html/ $ sudo usermod -a -G www-data <username> 點選桌面右上角的齒輪圖示,選擇登出 2.重新登入後,在/usr/share/nginx/html/中,新建一個phpinfo.php檔案,內容如下: <?php phpinfo(); 2.編輯/etc/nginx/conf.d/default.conf,對“pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000”(28行)下面的location做如下修改     location ~ \.php$ {         root           html;         fastcgi_pass   127.0.0.1:9000;         fastcgi_index  index.php;         fastcgi_param  SCRIPT_FILENAME  /usr/share/nginx/html$fastcgi_script_name;         include        fastcgi_params;     } 也就是,將每行前面的#號刪除;SCRIPT_FILENAME後面的“/scripts”改為“/usr/share/nginx/html” 3.重啟nginx。 $ sudo service nginx restart 4.在瀏覽器開啟http://localhost/phpinfo.php