centos 6.9 快速部署lnmp网站

本文详细介绍如何使用yum安装PHP、MySQL、Nginx等组件,并配置MySQL、Nginx及php-fpm服务,最后通过设置实现服务的启动与重启。

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

安装软件

yum install -y php php-mysql php-fpm nginx mysql mysql-server

mysql配置

/etc/my.cnf

[client]
port=3306
[mysql]
default-character-set=utf8

[mysqld]
skip-name-resolve
port=3306
character-set-server=utf8
default-storage-engine=MyISAM
#支持 INNODB 引擎模式。修改为 default-storage-engine=INNODB 即可。
#如果 INNODB 模式如果不能启动,删除data目录下ib开头的日志文件重新启动。

sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
max_connections=512

query_cache_size=0
table_cache=256
tmp_table_size=18M

thread_cache_size=8
myisam_max_sort_file_size=64G
myisam_sort_buffer_size=35M
key_buffer_size=25M
read_buffer_size=64K
read_rnd_buffer_size=256K
sort_buffer_size=256K

innodb_additional_mem_pool_size=2M

innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=1M

innodb_buffer_pool_size=47M
innodb_log_file_size=24M
innodb_thread_concurrency=8
  • 建立账号
grant all privileges on *.* to root@'%' identified by 'xxx';

grant all privileges on *.* to root@'localhost' identified by 'xxx';

flush privileges;

nginx配置

server {
    listen               80 default;
    server_name          www.xxx.com;

    client_max_body_size 4M;
    client_body_buffer_size 128k;

    root /opt/www/www.xxx.com;
    index index.php;

    location ~ \.php$ {
        #try_files $uri $uri/ /index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param REDIRECT_STATUS 200;
       # fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_pass 127.0.0.1:9000;
    }
}

php-fpm配置

nothing configure

启动

/etc/init.d/php-fpm restart
/etc/init.d/mysqld restart
/etc/init.d/nginx restart
chkconfig php-fpm on
chkconfig mysqld on
chkconfig nginx on
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值