安装部署

优质
小牛编辑
131浏览
2023-12-01
  • 操作系统:windows, linux, mac
  • 运行环境:Apache|Nginx + php5.3+ + mysql5.5+ 推荐使用Nginx,原因你懂的。
  • php扩展:openssl, pdo, mbstring, curl
  • 依赖:herophp/framework
  • composer 1.2.0+

拉取代码

git clone https://git.oschina.net/blackfox/herosphp-app.git

Nginx配置

herosphp-app nginx配置很简单,就是添加一个url重写就好了,将所有的php请求转发到app/index.php, 下面给出一个demo

server {
    listen   80;
    server_name  www.herosphp.my;
    root /php/herosphp-app;
    index index.php;
    #设定本虚拟主机的访问日志
    access_log  /dev/null;
    error_log /dev/null;

    # Make site accessible from http://localhost/

    location ~ .*\.(php|php5)?$
    {
        fastcgi_pass unix:/var/run/php7.0-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    #add surpport pathinfo visitd mode
    if (!-f $request_filename) {
           rewrite ^/.*$ /app/index.php last;
           break;
    }

}