lnmp

本文详细介绍了如何配置LNMP环境,包括nginx、mysql和php的配置步骤,最后展示了生成测试界面的过程。
摘要由CSDN通过智能技术生成

配置nginx

//创建系统用户nginx
[root@server ~]# useradd -r -M -s /sbin/nologin nginx
//安装依赖环境
[root@server ~]#  yum -y install pcre-devel openssl openssl-devel gd-devel gcc gcc-c++
[root@server ~]# yum -y groups mark install 'Development Tools'
//创建日志存放目录
[root@server ~]# mkdir -p /var/log/nginx
[root@server ~]# chown -R nginx.nginx /var/log/nginx
//编译安装
[root@server ~]# tar xf nginx-1.14.2.tar.gz 
[root@server ~]# cd nginx-1.14.2
[root@server nginx-1.14.2]#  ./configure \
> --prefix=/usr/local/nginx \
> --user=nginx \
> --group=nginx \
> --with-debug \
> --with-http_ssl_module \
> --with-http_realip_module \
> --with-http_image_filter_module \
> --with-http_gunzip_module \
> --with-http_gzip_static_module \
> --with-http_stub_status_module \
> --http-log-path=/var/log/nginx/access.log \
> --error-log-path=/var/log/nginx/error.log
[root@server nginx-1.14.2]# make -j $(grep 'processor' /proc/cpuinfo | wc -l) && make install
//配置环境变量
[root@server nginx-1.14.2]# echo 'export PATH=/usr/local/nginx/sbin:$PATH' > /etc/profile.d/nginx.sh
[root@server ~]# . /etc/profile.d/nginx.sh
[root@server ~]#  nginx
[root@server ~]#  ss -antl
State       Recv-Q Send-Q Local Address:Port               Peer Address:Port              
LISTEN      0      128               *:111                           *:*                  
LISTEN      0      128               *:80                            *:*                  
LISTEN      0      128               *:57330                         *:*                  
LISTEN      0      128               *:22                            *:*                  
LISTEN      0      100       127.0.0.1:25                            *:*                  
LISTEN      0      128              :::111                          :::*                  
LISTEN      0      128              :::22                           :::*                  
LISTEN      0      100             ::1:25                           :::*                  
LISTEN      0      128              :::49181                        :::*                  
//修改配置文件
[root@server ~]# vim /usr/local/nginx/conf/nginx.conf
location / {
            root   html;
            index  index.php index.html index.htm;
        }

 location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            include        fastcgi.params;
        }

配置mysql

//安装依赖包和下载二进制mysql包
[root@server ~]# yum -y install ncurses-devel openssl-devel openssl cmake mariadb-devel
[root@server ~]# groupadd -r -g 306 mysql
[root@server 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值