LNMP平台搭建-2简化版本
一。安装nginx 方法一 :老老实实的安装 systemctl stop firewalld yum -y install? pcre-devel? zlib-devel openssl-devel gcc gcc-c++??make useradd -M -s /sbin/nologin nginx tar xf nginx-1.14.2.tar.gz? -C /usr/src cd /usr/src/nginx-1.14.2/ ./configure? --prefix=/usr/local/nginx --user=nginx? --group=nginx --with-http_stub_status_module? --with-http_ssl_module? --with-http_flv_module --with-http_gzip_static_module? ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/ [[email?protected]]#nginx -t nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful nginx 查看结果 方法二 用fpm包安装 ,需要手动开启nginx服务 二 安装MySQL数据库 [[email?protected] ~]# tar xf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz -C /usr/local [[email?protected] ~]# cd /usr/local/ [[email?protected] local]# vim /etc/my.cnf [mysqld] datadir=/usr/local/mysql/data socket=/tmp/mysql.sock ? [mysqld_safe] log-error=/usr/local/mysql/data/mysql.log pid-file=/usr/local/mysql/data/mysql.pid [[email?protected] local]# /usr/local/mysql/bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize [[email?protected] mysql]# echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile [[email?protected] mysql]# source /etc/profile? ? ?##这两步可以用ln -s /usr/local/mysql/bin/*? /usr/local/sbin? ? 但是开启服务时用/etc/init.d/mysql start [[email?protected] local]# cd mysql/ [[email?protected] mysql]# cp support-files/mysql.server? /etc/init.d/mysqld? ?#复制到主配置文件就可以直接使用systemctl start mysqld [[email?protected] mysql]# chkconfig --add mysqld? #也可以用chmod +x? /etc/init.d/mysqld? [[email?protected] mysql]# systemctl start mysqld 三。安装PHP解析环境[[email?protected]~]# yum -y install gd libxml2-devel libjpeg-devel libpng-devel? ? gcc gcc-c++ make [[email?protected] ~]# tar xf php-5.6.39.tar.gz -C /usr/src/ [[email?protected] ~]# cd /usr/src/php-5.6.39/ [[email?protected]]# ./configure --prefix=/usr/local/php5 --with-gd --with-zlib --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-config-file-path=/usr/local/php5 --enable-mbstring --enable-fpm --with-jpeg-dir=/usr/lib && make && make install [[email?protected]]#cp php.ini-production /usr/local/php5/php.ini [[email?protected]]# ln -s /usr/local/php5/bin/* /usr/local/bin/ [[email?protected]]#ln -s /usr/local/php5/sbin/* /usr/local/sbin/ [[email?protected]~]# cd [[email?protected]~]# tar xf zend-loader-php5.6-linux-x86_64_update1.tar.gz ?-C /usr/src/ [[email?protected]~]# cd /usr/src/zend-loader-php5.6-linux-x86_64/ [[email?protected] zend-loader-php5.6-linux-x86_64]# cp ZendGuardLoader.so /usr/local/php5/lib/php/ ? [[email?protected] zend-loader-php5.6-linux-x86_64]#vim /usr/local/php5/php.ini zend_extension=/usr/local/php5/lib/php/ZendGuardLoader.so zend_loader.enable=1 四、配置Nginx支持PHP环境[[email?protected]~]# cd /usr/local/php5/etc/ [[email?protected]]# cp php-fpm.conf.default php-fpm.conf [[email?protected]]#useradd -M -s /sbin/nologin php sed -i ‘25c pid = run/php-fpm.pid‘ php-fpm.conf &> /dev/null /usr/local/sbin/php-fpm? cat << EOF > /usr/local/nginx/html/php.php vi /usr/local/nginx/con/nginx.conf? ? ##修改 ? ?killall -1? ngxin 登陆网页测试? #192.168.200.111/php.php (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |