Centos7.3 LNMP+phpMyAdmin 最新环境搭建
来源:互联网 发布:奥地利 知乎 编辑:程序博客网 时间:2024/06/12 03:58
一、准备环境
yum install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-develyum install freetype-devel bzip2-devel libmcrypt libmcrypt-devel postgresql-develyum install aspell-devel readline-devel libxslt-devel net-snmp-devel unixODBC-develyum install libicu-devel libc-client-devel libXpm-devel libvpx-devel enchant-develyum install openldap openldap-devel db4-devel gmp-devel sqlite-devel mysql-develyum install pcre* pcre-devel gcc-c++ zlib* curl-devel libpng-devel freetype-develyum install libmcrypt-devel bzip2 bzip2-devel libcurl libcurl-devel libjpegyum install libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-develyum install libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel
创建www用户以及www用户组
[root@ ~]#groupadd www[root@ ~]#useradd -g www www
查看是否有残留 php、nginx和apache同理
rpm -qa | gerp mysqlfind / -name mysql
二、编译安装nginx 1.13.2
下载解压进入并检查配置(可一步执行)
cd /wget nginx.org/download/nginx-1.13.2.tar.gztar -xzvf nginx-1.13.2.tar.gzcd nginx-1.13.2./configure
./configure \--prefix=/usr/local/nginx \--sbin-path=/usr/local/nginx/sbin/nginx \--conf-path=/usr/local/nginx/conf/nginx.conf \--error-log-path=/var/log/nginx/error.log \--http-log-path=/var/log/nginx/access.log \--pid-path=/var/run/nginx/nginx.pid \--lock-path=/var/lock/nginx.lock \--user=www \--group=www \--with-http_ssl_module \--with-http_stub_status_module \--with-http_gzip_static_module \--http-client-body-temp-path=/var/tmp/nginx/client/ \--http-proxy-temp-path=/var/tmp/nginx/proxy/ \--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \--http-scgi-temp-path=/var/tmp/nginx/scgi \--with-pcre
./configure \--with-http_ssl_module \--with-http_stub_status_module \--with-http_gzip_static_module \--with-pcre
make && make install
whereis nginx
cd /usr/local/nginx/sbin/./nginx
三、yum安装mysql 5.7.19
下载安装
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpmyum -y localinstall mysql57-community-release-el7-11.noarch.rpmyum -y install mysql-community-server
systemctl start mysqldsystemctl enable mysqldsystemctl daemon-reload
grep 'temporary password' /var/log/mysqld.log
mysql -u root -pinput_temPASSWORD
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('******');
show databases;
exit
systemctl restart mysqld
四、编译安装php 7.1.8
下载解压进入
wget -c http://cn2.php.net/distributions/php-7.1.8.tar.gztar -xzvf php-7.1.8.tar.gzcd php-7.1.8
./configure \--prefix=/usr/local/php \--with-config-file-path=/usr/local/php/etc \--enable-fpm \--with-fpm-user=www \--with-fpm-group=www \--enable-inline-optimization \--disable-debug \--disable-rpath \--enable-shared \--enable-soap \--with-xmlrpc \--with-openssl \--with-mcrypt \--with-pcre-regex \--with-sqlite3 \--with-zlib \--enable-bcmath \--with-iconv \--with-bz2 \--enable-calendar \--with-curl \--with-cdb \--enable-dom \--enable-exif \--enable-fileinfo \--enable-filter \--with-pcre-dir \--enable-ftp \--with-gd \--with-openssl-dir \--with-jpeg-dir \--with-png-dir \--with-freetype-dir \--enable-gd-native-ttf \--enable-gd-jis-conv \--with-gettext \--with-gmp \--with-mhash \--enable-json \--enable-mbstring \--enable-mbregex \--enable-mbregex-backtrack \--with-libmbfl \--with-onig \--enable-pdo \--with-mysqli=mysqlnd \--with-pdo-mysql=mysqlnd \--with-zlib-dir \--with-pdo-sqlite \--with-readline \--enable-session \--enable-shmop \--enable-simplexml \--enable-sockets \--enable-sysvmsg \--enable-sysvsem \--enable-sysvshm \--enable-wddx \--with-libxml-dir \--with-xsl \--enable-zip \--enable-mysqlnd-compression-support \--with-pear \--enable-opcache
make && make install
编译正常结果
Build complete.Don't forget to run 'make test'.Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/Installing PHP CLI binary: /usr/local/php/bin/Installing PHP CLI man page: /usr/local/php/php/man/man1/Installing PHP FPM binary: /usr/local/php/sbin/Installing PHP FPM defconfig: /usr/local/php/etc/Installing PHP FPM man page: /usr/local/php/php/man/man8/Installing PHP FPM status page: /usr/local/php/php/php/fpm/Installing phpdbg binary: /usr/local/php/bin/Installing phpdbg man page: /usr/local/php/php/man/man1/Installing PHP CGI binary: /usr/local/php/bin/Installing PHP CGI man page: /usr/local/php/php/man/man1/Installing build environment: /usr/local/php/lib/php/build/Installing header files: /usr/local/php/include/php/Installing helper programs: /usr/local/php/bin/ program: phpize program: php-configInstalling man pages: /usr/local/php/php/man/man1/ page: phpize.1 page: php-config.1Installing PEAR environment: /usr/local/php/lib/php/[PEAR] Archive_Tar - installed: 1.4.3[PEAR] Console_Getopt - installed: 1.4.1[PEAR] Structures_Graph- installed: 1.1.1[PEAR] XML_Util - installed: 1.4.2[PEAR] PEAR - installed: 1.10.5Wrote PEAR system config file at: /usr/local/php/etc/pear.confYou may want to add: /usr/local/php/lib/php to your php.ini include_path/root/php-7.1.8/build/shtool install -c ext/phar/phar.phar /usr/local/php/binln -s -f phar.phar /usr/local/php/bin/pharInstalling PDO headers: /usr/local/php/include/php/ext/pdo/
将/usr/local/php/etc中的php-fpm.conf.default复制一个并改为php-fpm.conf
将/usr/local/php/etc/php-fpm.d中的www.conf.default复制并改为www.conf
查看版本
/usr/local/php/bin/php -v
/usr/local/php/sbin/php-fpm
五、安装phpMyAdmin 4.7.3
下载并解压上传到/root/www 即nginx中的目的位置
修改config.default.php 在phpMyAdmin\libraries
$cfg['PmaAbsoluteUri'] = 'http://x.x.x.x/phpMyAdmin/';(访问地址 否则可能2002)$cfg['Servers'][$i]['host'] = 'localhost';(或者为127.0.0.1)
六、nginx简单配置及脚本
默认web位置修改
打开 /usr/local/nginx/conf/nginx.conf
location / { root /root/www; 改为目的位置 index index.php index.html index.htm;}
注意赋权 chmod 777 -R /root 此处为目的位置的根目录
关联php
location ~ \.php$ { 去掉#号注释 root /root/www; 改为目的位置 fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /root/www$fastcgi_script_name; include fastcgi_params; index index.php index.html;}
脚本
创建文件nginx,复制脚本代码
#!/bin/sh## nginx - this script starts and stops the nginx daemon## chkconfig: - 85 15# description: NGINX is an HTTP(S) server, HTTP(S) reverse \# proxy and IMAP/POP3 proxy server# processname: nginx# config: /etc/nginx/nginx.conf# config: /etc/sysconfig/nginx# pidfile: /var/run/nginx.pid# Source function library.. /etc/rc.d/init.d/functions# Source networking configuration.. /etc/sysconfig/network# Check that networking is up.[ "$NETWORKING" = "no" ] && exit 0nginx="/usr/sbin/nginx"prog=$(basename $nginx)NGINX_CONF_FILE="/etc/nginx/nginx.conf"[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginxlockfile=/var/lock/subsys/nginxmake_dirs() { # make required directories user=`$nginx -V 2>&1 | grep "configure arguments:.*--user=" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -` if [ -n "$user" ]; then if [ -z "`grep $user /etc/passwd`" ]; then useradd -M -s /bin/nologin $user fi options=`$nginx -V 2>&1 | grep 'configure arguments:'` for opt in $options; do if [ `echo $opt | grep '.*-temp-path'` ]; then value=`echo $opt | cut -d "=" -f 2` if [ ! -d "$value" ]; then # echo "creating" $value mkdir -p $value && chown -R $user $value fi fi done fi}start() { [ -x $nginx ] || exit 5 [ -f $NGINX_CONF_FILE ] || exit 6 make_dirs echo -n $"Starting $prog: " daemon $nginx -c $NGINX_CONF_FILE retval=$? echo [ $retval -eq 0 ] && touch $lockfile return $retval}stop() { echo -n $"Stopping $prog: " killproc $prog -QUIT retval=$? echo [ $retval -eq 0 ] && rm -f $lockfile return $retval}restart() { configtest || return $? stop sleep 1 start}reload() { configtest || return $? echo -n $"Reloading $prog: " killproc $nginx -HUP RETVAL=$? echo}force_reload() { restart}configtest() { $nginx -t -c $NGINX_CONF_FILE}rh_status() { status $prog}rh_status_q() { rh_status >/dev/null 2>&1}case "$1" in start) rh_status_q && exit 0 $1 ;; stop) rh_status_q || exit 0 $1 ;; restart|configtest) $1 ;; reload) rh_status_q || exit 7 $1 ;; force-reload) force_reload ;; status) rh_status ;; condrestart|try-restart) rh_status_q || exit 0 ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" exit 2esac
脚本需修改的地方
修改成nginx执行程序的路径
nginx=”/usr/sbin/nginx”
NGINX_CONF_FILE=”/etc/nginx/nginx.conf”
lockfile
查看nginx文件
:set ff? #可以看到dos或unix的字样. 如果的确是dos格式的。:set ff=unix #把它强制为unix格式的, 然后:wq存盘退出。
保存脚本文件后设置文件的执行权限:
chmod a+x /etc/init.d/nginx
就可以通过该脚本对nginx服务进行管理了:
/etc/init.d/nginx start/etc/init.d/nginx stop
先将nginx服务加入chkconfig管理列表:
chkconfig --add /etc/init.d/nginx
service nginx startservice nginx stop
chkconfig nginx on
七、php简单配置及脚本
将/root/php-7.1.8/sapi/fpm中的php-fpm复制到/etc/rc.d/init.d
注意:php-fpm.pid文件(根据配置应在/usr/local/php/var/run)
如有需要 可根据安装路径修改参数
阅读全文
0 0
- Centos7.3 LNMP+phpMyAdmin 最新环境搭建
- 2017年最新 centos7 LNMP环境搭建
- CentOS7 LNMP环境搭建
- centos7搭建lnmp环境
- CentOS7-搭建LNMP环境
- CentOS7 LNMP环境搭建
- CentOS7之搭建lnmp环境
- CentOS7快速搭建LNMP环境
- mac+virtualbox+centos7+docker搭建lnmp环境
- centos7.0下lnmp环境搭建
- centos7.0下lnmp环境搭建
- php环境搭建 vmbox + centos7 + laravel +lnmp
- CentOS7 LNMP环境搭建Zabbix3.0
- linux Centos7.2 lnmp 环境搭建
- 阿里云 centos7 lnmp环境搭建
- 阿里云CentOS7.3手动搭建LNMP
- linux centOS7 lnmp搭建
- CentOS6.3搭建lnmp环境
- 常见的排序算法C语言实现(—)
- 理解Linux文件权限
- find the mincost route(城市最小环)
- HDU 6090 Rikka with Graph【思维题】
- 芳姐和芳姐的猪
- Centos7.3 LNMP+phpMyAdmin 最新环境搭建
- SpringMVC 自动绑定数据
- C++知识总结(5)
- NYOJ 467 中缀式变后缀式
- 产品经理该如何与设计师沟通?
- 1831 小C的游戏(博弈、规律)
- centOS7 安装nginx
- Recall(召回率) Precision(准确率) F-Measure E值 sensitivity(灵敏性) specificity(特异性)漏诊率 误诊率 ROC AUC
- Qt 绘制圆角 QWidget