ubuntu 10.10安裝nginx+php的過程
裝上系統也有一段時間了,也沒有裝,今天工作時打算用ubuntu開發了,所以就安裝nginx,在公司電腦就一路順風啊!
安裝教程地址在這裡:http://www.cnblogs.com/breg
當然可以baidu,google其實大體上都差不多,
回家時把我的本本也裝上吧!誰知道公司電腦的順利在筆記本上就一波三折,最終在多費很多時間和腦力的情況下終於圓滿解決!
其實具體還是很簡單的,只是要注意幾個配置的問題!
其主要配置有這些:
1.sudo gedit /etc/nginx/sites-available/default
server {listen 80; ## listen for ipv4listen [::]:80 default ipv6only=on; ## listen for ipv6server_name localhost;access_log /var/log/nginx/localhost.access.log;location / {root /var/www/nginx-default;index index.html index.htm index.php;}location /doc {root /usr/share;autoindex on;allow 127.0.0.1;deny all;}location /images {root /usr/share;autoindex on;}error_page 404 /404.html;# redirect server error pages to the static page /50x.html#error_page 500 502 503 504 /50x.html;location = /50x.html {root /var/www/nginx-default;}# proxy the PHP scripts to Apache listening on 127.0.0.1:80##location ~ \.php$ {#proxy_pass http://127.0.0.1;#}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000location ~ \.php$ {fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME /var/www/nginx-default$fastcgi_script_name; #注意替換網站路徑,不然要報input的錯誤include fastcgi_params; #特別注意此處有空格,原始檔案時沒有空格的,我的nginx啟動不了就是忘了改這裡}# deny access to .htaccess files, if Apache's document root# concurs with nginx's one##location ~ /\.ht {#deny all;#}}
2.sudo gedit /etc/php5/cgi/php.ini
;zend的安裝[Zend Optimizer]zend_optimizer.optimization_level=1zend_extension="/etc/zend/ZendOptimizer.so" ;將引號路徑換成自己的路徑;將注釋去掉cgi.fix_pathinfo=1;