yum安装配置lnmp

安装nginx

 yum install nginx -y

注:修改/etc/nginx/conf.d/default.conf,去除对 IPv6 地址的监听。CentOS 6 不支持 IPv6,需要取消对 IPv6 地址的监听,否则 Nginx 不能成功启动。

完成后启动nginx

nginx

安装 MySQL 数据库服务

yum install mysql-server -y

安装完成后,启动 MySQL 服务

service mysqld start

设置 MySQL 账户 root 密码d

/usr/bin/mysqladmin -u root password 'Password'

将 MySQL 设置为开机自动启动

chkconfig mysqld on

安装 PHP

yum install php php-fpm php-mysql  -y

安装之后,启动 PHP-FPM 进程

service php-fpm start

启动之后,可以使用下面的命令查看 PHP-FPM 进程监听哪个端口

netstat -nlpt | grep php-fpm

把 PHP-FPM 也设置成开机自动启动

chkconfig php-fpm start

配置 Nginx 并运行 PHP 程序

/etc/nginx/conf.d目录中新建一个名为 php.conf 的文件,并配置 Nginx 端口 ,配置示例如下

示例代码:/etc/nginx/conf.d/php.conf

server {

    listen 8000;

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

    location ~ .php$ {

        root          /usr/share/php;

        fastcgi_pass  127.0.0.1:9000;

        fastcgi_index  index.php;

        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

        include        fastcgi_params;

    }

}

修改配置完成后,重启 nginx 服务

service nginx restart

sudo fuser -k 80/tcp 如果有80端口被占用的情况

安装nginx yum install nginx -y

启动nginx       systemctl start nginx.service

开机启动nginx systemctl enable nginx.service

安装php7 https://www.jianshu.com/p/8d54a401ec06

安装mysql https://blog.csdn.net/u011886447/article/details/79796802

mysql 默认密码问题 https://www.yanning.wang/archives/379.html

启动mysql   systemctl start mysqld.service 

 开机启动  systemctl enable mysqld.service

nginx 403问题 未知

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1.写在前面 本文主要介绍的是zabbix的编译安装过程,包含它的基础环境LNMP,虽然zabbix官方一般推荐的...
    天之蓝色阅读 2,561评论 0 16
  • 系统环境 所需软件官方下载地址: 一、 安装开发包环境: 二、 关闭iptables和Selinux(生产...
    莫名其妙的一生阅读 1,323评论 0 4
  • 昨晚阿里云不知搞得啥活动,就入手了一台香港的云服务器,买了三年,价格也是很便宜,今天就给它搭建了一个lnmp环境,...
    nooops阅读 687评论 0 0
  • 近日,从ubuntu切换到centos6,所以暂时先使用yum安装来搭建php环境 参考了网上的一些文章:链接1h...
    MORESIR阅读 295评论 1 1
  • 可乐喝多了是会睡不着的…这不,没睡着码字呢么… 这2015年过的,没什么实感。感觉上一次回复新年快乐微信回复到手指...
    阿炫要做一个温暖的人阅读 241评论 0 0