ubuntu 10.10安装nginx+php的过程

本文详细记录了在Ubuntu 10.10系统中安装配置Nginx和PHP的过程,包括配置文件的具体修改,如监听端口、网站根目录、FastCGI参数等,以及解决过程中遇到的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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;

转载于:https://www.cnblogs.com/breg/archive/2011/12/06/2277927.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值