资讯专栏INFORMATION COLUMN

CentOS LNMP 环境搭建记录

2450184176 / 2219人阅读

*仅供参考,如有不当之处,欢迎批评指正。以下安装过程以 CentOS 5.* 系列为例 *

准备需要的源 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
4、添加 MySQL 官方源:

项目地址:https://dev.mysql.com/downloads/repo/yum/
安装步骤:

//根据 CentOS 版本不同,下方地址也不同
wget https://dev.mysql.com/get/mysql-community-release-el5-5.noarch.rpm --no-check-certificate
//安装
rpm -ivh mysql-community-release-el5-5.noarch.rpm
//查看 MySQL 源的软件列表
yum --disablerepo=* --enablerepo=mysql56-community list available | less
安装 安装 PHP
yum --enablerepo=remi,remi-php56,epel install php
安装 PHP 相关扩展
yum --enablerepo=remi,remi-php56,epel install php-gd php-mcrypt php-mbstring php-mysql php-pecl-memcached php-fpm
安装 Nginx
yum --disablerepo=* --enablerepo=nginx install nginx
安装 MySQL
yum --disablerepo=* --enablerepo=mysql56-community install mysql mysql-server
相关配置 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;
        }
    }

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/45597.html

相关文章

  • CentOS LNMP 环境搭建记录

    *仅供参考,如有不当之处,欢迎批评指正。以下安装过程以 CentOS 5.* 系列为例 * 准备需要的源 1、添加 EPEL 源: 项目地址:http://fedoraproject.org/wiki/EPEL 安装步骤: //根据 CentOS 版本不同,下方地址也不同 wget http://ftp.sjtu.edu.cn/fedora/epel/5/i386/epel-release...

    Ajian 评论0 收藏0
  • CentOS LNMP 环境搭建记录

    *仅供参考,如有不当之处,欢迎批评指正。以下安装过程以 CentOS 5.* 系列为例 * 准备需要的源 1、添加 EPEL 源: 项目地址:http://fedoraproject.org/wiki/EPEL 安装步骤: //根据 CentOS 版本不同,下方地址也不同 wget http://ftp.sjtu.edu.cn/fedora/epel/5/i386/epel-release...

    bitkylin 评论0 收藏0
  • CentOS LNMP 环境搭建记录

    *仅供参考,如有不当之处,欢迎批评指正。以下安装过程以 CentOS 5.* 系列为例 * 准备需要的源 1、添加 EPEL 源: 项目地址:http://fedoraproject.org/wiki/EPEL 安装步骤: //根据 CentOS 版本不同,下方地址也不同 wget http://ftp.sjtu.edu.cn/fedora/epel/5/i386/epel-release...

    Me_Kun 评论0 收藏0
  • 虚拟机Linux Centos7搭建web环境LNMP

    摘要:本文内容是,如何在下快速搭建环境。虚拟机实体机环境都可以。按照提示,输入。 本文内容是,如何在Linux centos7下快速搭建LNMP环境。虚拟机、实体机环境都可以。另外,安装教程参考的是,下面这篇文章进行文字排版和内容扩充,感谢hcchanqing作者。CentOS6.2 yum安装配置LNMP服务器(Nginx+PHP+MySQL) 特别提醒:本文系统用的Centos7,是7!...

    Gu_Yan 评论0 收藏0
  • 虚拟机Linux Centos7搭建web环境LNMP

    摘要:本文内容是,如何在下快速搭建环境。虚拟机实体机环境都可以。按照提示,输入。 本文内容是,如何在Linux centos7下快速搭建LNMP环境。虚拟机、实体机环境都可以。另外,安装教程参考的是,下面这篇文章进行文字排版和内容扩充,感谢hcchanqing作者。CentOS6.2 yum安装配置LNMP服务器(Nginx+PHP+MySQL) 特别提醒:本文系统用的Centos7,是7!...

    阿罗 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<