php/phpmyadmin新手式環境搭建


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 = www
group = www

還有就是授權, 扔一個執行全與所屬用戶

chmod -R 777 /etc/php-fpm.d/www.conf
chown -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 

下面就是 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!!

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM