设为首页 收藏本站
查看: 1077|回复: 0

CentOS LNMP 环境搭建记录

[复制链接]

尚未签到

发表于 2015-8-21 12:57:00 | 显示全部楼层 |阅读模式
准备需要的源

1、添加 EPEL 源:


  项目地址: http://fedoraproject.org/wiki/EPEL
  安装步骤:

//根据 CentOS 版本不同,下方地址也不同
wget http://ftp.sjtu.edu.cn/fedora/epel/5/i386/epel-release-5-4.noarch.rpm
//安装
rpm -ivh epel-release-5-4.noarch.rpm

2、添加 Remi 源:


  项目地址: http://rpms.famillecollet.com/
  安装步骤:

//根据 CentOS 版本不同,下方地址也不同
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
//安装
rpm -ivh remi-release-5.rpm
#查看 Remi 源的软件列表
yum --disablerepo=* --enablerepo=remi,remi-php55,remi-test list available | less

3、添加 Nginx 官方源:


  项目地址: http://nginx.org/en/linux_packages.html#stable
  安装步骤:

//根据 CentOS 版本不同,下方地址也不同
wget http://nginx.org/packages/centos/5/noarch/RPMS/nginx-release-centos-5-0.el5.ngx.noarch.rpm
//安装
rpm -ivh nginx-release-centos-5-0.el5.ngx.noarch.rpm

安装

安装 PHP

yum --enablerepo=remi,remi-php55,epel install php

安装 PHP 相关扩展

yum --enablerepo=remi,remi-php55,epel install php-gd php-mcrypt php-mbstring php-mysql php-pecl-memcached php-fpm

安装 MySQL
  yum --enablerepo=remi,remi-php55,epel install mysql mysql-server

安装 Nginx
  yum --enablerepo=remi,remi-php55,epel install nginx

相关配置

MySQL 参考配置

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
character-set-server=utf8
skip-name-resolve
slow_query_log=1
slow_query_log_file=/var/log/mysql/slowquery.log
log-queries-not-using-indexes=on #记录没有使用索引的查询
server-id=3
log-bin=mysql-bin
expire_logs_days = 10

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used (fedora >= 15).
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd
user=mysql
# Semisynchronous Replication
# http://dev.mysql.com/doc/refman/5.5/en/replication-semisync.html
# uncomment next line on MASTER
;plugin-load=rpl_semi_sync_master=semisync_master.so
# uncomment next line on SLAVE
;plugin-load=rpl_semi_sync_slave=semisync_slave.so
# Others options for Semisynchronous Replication
;rpl_semi_sync_master_enabled=1
;rpl_semi_sync_master_timeout=10
;rpl_semi_sync_slave_enabled=1
# http://dev.mysql.com/doc/refman/5.5/en/performance-schema.html
;performance_schema
#innodb
innodb_file_per_table=1
innodb_flush_log_at_trx_commit=2
innodb_buffer_pool_size=1G
innodb_log_buffer_size=16M
innodb_log_file_size=128M
back_log=100
max_connections=1200
max_allowed_packet=2M
max_heap_table_size=64M
sort_buffer_size=16M
join_buffer_size=16M
thread_cache_size=16
tmp_table_size=64M
key_buffer_size=64M
read_rnd_buffer_size=16M
bulk_insert_buffer_size=128M
myisam_sort_buffer_size=128M
myisam_recover
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

Nginx PATHINFO 参考配置片段

server {
listen       80;
server_name  top.qimai.net;
root   /usr/share/nginx/html/appstore;
location / {
root   /usr/share/nginx/html/appstore;
index  index.php index.html index.htm;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ [^/]\.php(/|$) {
fastcgi_index   index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param   PATH_INFO   $fastcgi_path_info;
fastcgi_param   PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_pass    unix:/var/run/php5-fpm.sock;
include fastcgi_params;
}
}


  • 本文来自:Linux学习教程网

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-102197-1-1.html 上篇帖子: LNMP一键安装包是什么? 下篇帖子: MAC自带的lnmp
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表