ubuntu 10.10安装nginx+php的过程
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 ipv4
listen [::]:80 default ipv6only=on; ## listen for ipv6
server_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:9000
location ~ \.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=1 zend_extension="/etc/zend/ZendOptimizer.so" ;将引号路径换成自己的路径 ;将注释去掉cgi.fix_pathinfo=1;
浙公网安备 33010602011771号