CentOS6.x使用YUM安装配置LNMP运行环境

一、Nginx

# cd /tmp
# wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
# rpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm
# yum install nginx

站点配置样本:

server {
	listen 80;
	server_name www.chnlanker.net;
	root /usr/www/;
	index index.html index.php;

	access_log /var/log/nginx/access_filename.log main;
	error_log /var/log/nginx/error_filename.log warn;
	error_page 404 /404.html;
	error_page 500 502 503 504 /50x.html;

	location ~ \.php$ {
		fastcgi_pass 127.0.0.1:9000;
		fastcgi_index index.php;
		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
		fastcgi_param PHP_ADMIN_VALUE open_basedir=$document_root;
		include fastcgi_params;
	}
	location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
		expires 30d;
	}
	location ~ .*\.(js|css)?$ {
		expires 12h;
	}
}

默认安装目录: /etc/nginx/
默认SSL和虚拟主机配置目录: /etc/nginx/conf.d/
默认日志保存目录: /var/log/nginx/
默认网站文件目录: /usr/share/nginx/html
默认配置文件: /etc/nginx/nginx.conf
默认访问日志文件: /var/log/nginx/access.log
默认错误日志文件: /var/log/nginx/error.log

二、MYSQL

# yum install mysql mysql-server
# chkconfig mysqld on
# service mysqld start
# mysqladmin -u root password 'your-password'

配置文件路径:/etc/my.cnf
数据库路径:/var/lib/mysql

三、PHP

# yum install php-common php-fpm php-cli php-pdo php-mysql php-mcrypt php-mbstring php-gd php-tidy php-xml php-xmlrpc php-pear php-pecl-memcache php-eaccelerator
# chown nginx:nginx /etc/php-fpm.conf
# mkdir /var/lib/php/session
# chown -R nginx:nginx /var/lib/php/session
# chkconfig php-fpm on
# service php-fpm start

配置文件路径:/etc/php.ini
扩展模块路径:/usr/lib/php/modules (32bit)
/usr/lib64/php/modules (64bit)

转载请注明: 本文转载自中国蓝客联盟官方团队博客
本文链接地址: CentOS6.x使用YUM安装配置LNMP运行环境

发表评论

电子邮件地址不会被公开。 必填项已用*标注

人类验证码: 如果无法查看图片请刷页面