CentOS7搭建PHP镜像站

  1. 搭建前的准备

    yum install rsync -y
    
  2. 创建源码目录

    useradd www
    mkdir -p /www/php-web
    chown -R www:www /www/php-web
    
  3. 获取镜像站源码(时间较长)

    su www
    cd /www/php-web
    rsync -avzC --timeout=600 --delete --delete-after --include='distributions/*.exe' ASIA.RSYNC.PHP.NET::phpweb /www/php-web
    
  4. 定期更新镜像站源码(计划任务)

    su www
    crontab -e
    5 * * * * rsync -avzC --timeout=600 --delete --delete-after --include='distributions/*.exe' ASIA.RSYNC.PHP.NET::phpweb /www/php-web
    ESC
    :wq
    
  5. 安装PHP

  6. 安装Nginx

  7. 修改nginx配置

    server {
        listen      80;
        server_name php.xxx.com;
        root        /www/php-web;
        index       index.php index.html;
    
        location / {
            try_files $uri $uri/ $uri.php;
        }
    
        location ~* \.php {
            fastcgi_pass            127.0.0.1:9000;
            fastcgi_index           index.php;
            fastcgi_split_path_info ^(.+\.php)(.*)$;
            fastcgi_param           PATH_INFO       $fastcgi_path_info;
            fastcgi_param           SCRIPT_NAME     $fastcgi_script_name;
            fastcgi_param           SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include                 fastcgi_params;
        }
    }
    
  8. 购买并备案域名

  9. 修改DNS解析到镜像站

  10. 参考链接

Copyright © 豆包嘿嘿~ 2012-∞ 冀ICP备17033181号 all right reserved,powered by Gitbook修订: 21-06-15 16:29

results matching ""

    No results matching ""