php新手式环境搭建

之前就在折腾 zabbix 的时候遇到一个情况, 安装 php6 的时候各种库丢失, 最重要的 gd 经常跑路

只是无意中遇到了一种小方式, 现在已经迷糊了, 前天因为在部署 phpAdmin 的时候搬出来旧的记录资料, 是关于 php7 的,

yum install php70w-common php70w-fpm php70w-opcache php70w-gd php70w-mysqlnd php70w-mbstring php70w-pecl-redis php70w-pecl-memcached php70w-devel php70w-xml php70w-bcmath php70w-ldap -y

其实就是这么小段, 经常被使用到, 其实还需要链接到 Webtatic 仓库

 yum install https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

只要 install 了 webtatic 就会在软件源目录吐出来三个源, 

webtatic.repo: 主文件webtatic-testing.repo: 测试仓库webtatic-archive.repo: 存档包仓库

那就 yum clean all && yum list 重新生成一下吧, 生成之后就能继续执行上面第一句的 install 语句了

完整 install 下来

接下来就是配置了

本人比较喜欢使用 www 而对 apache 则不是那么敏感

useradd www -s /usr/sbin/nologin -M

既然如此, 那 www.conf 中的用户与组的权限就得变更了

user = wwwgroup = www

还有就是授权, 扔一个执行全与所属用户

chmod -R 777 /etc/php-fpm.d/www.confchown -R www:www /etc/php-fpm.d/www.conf

最后就是修改 php.ini 了

主要的就是把 php.ini 中的 session.save_path 参数目录变更一下 (个人)

session.save_path="/var/lib/php/session/"

后面就是收尾了

mkdir -p /var/lib/php/session/chmod -R 777 /var/lib/php/chown -R www:www /var/lib/php/

收尾成功!

start一下, 9000 port 成功。

php-fpm

 

下面就是 PhpMyAdmin 的表演时间了, 就那么几步

 第一, 把小包包拉下来

https://files.phpmyadmin.net/phpMyAdmin/4.9.4/phpMyAdmin-4.9.4-all-languages.tar.gz

再配置一个 nginx 去转发过去就好啦, 生活如此美妙

我用的是 upstream 模块方式, 习惯了

全贴上来吧

user www www;worker_processes auto;pid /tmp/nginx.pid;error_log /tmp/nginx_error.log;worker_rlimit_nofile 51200;events { use epoll; worker_connections 51200;}http { include mime.types; default_type application/octet-stream; limit_req_zone $binary_remote_addr zone=one:10m rate=3r/s; limit_conn_zone $binary_remote_addr zone=addr:10m; server_tokens off;log_format main ‘$remote_addr - $remote_user [$time_local] ‘ ‘fwf[$http_x_forwarded_for] tip[$http_true_client_ip] ‘ ‘$upstream_addr $upstream_response_time $request_time ‘ ‘$http_host $request ‘ ‘"$status" $body_bytes_sent "$http_referer" ‘ ‘"$http_accept_language" "$http_user_agent" ‘; access_log /tmp/nginx_access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; map $http_upgrade $connection_upgrade { default upgrade; ‘‘ close; } proxy_connect_timeout 10; proxy_read_timeout 180; proxy_send_timeout 5; proxy_buffer_size 16k; proxy_buffers 4 32k; proxy_busy_buffers_size 96k; proxy_temp_file_write_size 96k; proxy_temp_path /tmp/temp_dir; proxy_cache_path /tmp/cache levels=1:2 keys_zone=cache_one:100m inactive=1d max_size=10g; index index.html; upstream centos7{ server 127.0.0.1:61080; } upstream ubuntu{ server 127.0.0.1:62080; } upstream dockerUI{ server 127.0.0.1:60009; } include vhost/*.conf;

我把配置扔在 vhost 文件夹下了
命名: nginx_PhpMyAdmin.conf

server { listen 80; #listen 443 ssl http2; server_name *.lifangyuan.xyz lifangyuan.xyz; #ssl_certificate fangyuan.pem; #ssl_certificate_key fangyuan.key; #if ($https != on) { # return 301 https://$host$request_uri; #} charset UTF8; index index.html index.htm index.php index.jsp; root /opt/phpMyAdmin; access_log /tmp/phpMyAdmin.log main; location /phpmyadmin/ { index index.html index.htm index.php; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /opt/phpMyAdmin$fastcgi_script_name; include fastcgi_params; } }

  

此刻, nginx -t success!!

 

相关文章