LNMP配置 nignx1.12+php5.6.30+mysql5.6

话不多说直接操作:

(1)、安装nginx依赖:yum install gcc gcc-c++ openssl openssl-devel cyrus-sasl-md5

下载nginx:wget http://nginx.org/download/nginx-1.12.2.tar.gz

解压:tar zxvf nginx-1.12.2.tar.gz

进入nginx目录中并编译安装:

cd nginx-1.12.2

./configure --prefix=/usr/local/nginx --with-http_ssl_module

make && make install 

加入环境变量:vi /etc/profile

export PATH= "$PATH:/usr/local/nginx/sbin:"

更新环境变量配置:source /etc/profile

配置项目:/var/www/project

进入/usr/local/nginx/conf/

创建:vhosts文件夹

vi nginx.conf

添加:include vhosts/*.conf

vi project.conf

server {
    listen       80;
    server_name  140.143.164.43;       
    #自定义的域名,因为我在内部有自己的DNS服务器
    root    /home/www/project;                                         
    #这个目录看有没有必要再重新指定,默认打算将showdoc代码包解到这里也行
    index index.php index.html
    error_page  404              /404.html;
    location = /40x.html {
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
    }
    location ~ \.php$ {
        root           /home/www/project;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
    location ~ /\.ht {
        deny  all;
    }
}

(2)、安装php依赖

yum install gcc gcc-c++ libxml2 libxml2-devel autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel  zlib zlib-devel glibc glibc-devel glib2 glib2-devel

下载php:wget  http://au1.php.net/get/php-5.6.30.tar.gz/from/this/mirror

mv mirror php-5.6.30.tar.gz

tar zxvf  php-5.6.30.tar.gz

./configure --prefix=/usr/local/php --enable-fpm --with-zlib  --with-pdo-mysql --enable-mbstring --with-gd --with-png-dir=/usr/lib64 --with-jpeg-dir=/usr/lib64 --with-freetype-dir=/usr/lib64

安装:

make && make install 

cd /usr/local/php/etc

cp php-fpm.conf.default php-fpm.conf

vi php-fpm.conf

去除pid=run/php-fpm.pid前面的;

user=web

group=web

保存退出

启动:/usr/local/php/sbin/php-fpm

(3)、yum安装mysql

安装资源包​:rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

安装:yum -y install mysql-community-server

重置密码: mysql_secure_installation

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值