CodeFec 开源版安装教程

环境要求

  1. php版本 >=8.0
  2. php 必须安装swoole扩展
  3. php 必须安装fileinfo扩展
  4. 服务器必须安装redis(php可以不用安装redis扩展)
  5. mysql版本 5.7-8.0
  6. nginx版本大于1.15

如果你用的是宝塔面板,解除以下被禁用的函数:

putenv,shell_exec,proc_open,pcntl_exec,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority

安装

在满足以上要求的环境下

打开终端,cd到你想将CodeFec安装在下面的目录下

执行:

wget -qO- https://raw.githubusercontent.com/zhuchunshu/CodeFec-Install.sh/main/install.sh | bash

 

 

然后按照相关提示进行安装(记得执行两次安装脚本)

程序会安装在 脚本执行目录/CodeFec

安装成功 (操作完本教程)后,你可以将程序目录移动到任意位置(改名也可以)

守护网站进程

通过堡塔应用管理器

启动文件选择网站根目录下的artisan文件

启动参数写:

octane:start --port=6700

 

其中6700是端口

uploadsimagestopicd2b5ca33bd970f64a6301fa75ae2eb22pP7hGNdt.png

然后守护horizon

堡塔应用管理器里这样配置:

启动文件选择网站根目录下的artisan文件

启动参数写:

horizon

 

uploadsimagestopicd2b5ca33bd970f64a6301fa75ae2eb22TcYRKAzP.png

网站配置

一、传统方式(访问速度快)

Nginx配置

server模块之前加上以下内容:

gzip on;
gzip_min_length 1024;
gzip_comp_level 2;
gzip_types text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml application/x-httpd-php image/jpeg image/gif image/png font/ttf font/otf image/svg+xml;
gzip_vary on;
gzip_disable "msie6";
upstream swoole {
    # 通过 IP:Port 连接
    server 127.0.0.1:6700 weight=5 max_fails=3 fail_timeout=30s;
    # 通过 UnixSocket Stream 连接,小诀窍:将socket文件放在/dev/shm目录下,可获得更好的性能
    #server unix:/yourpath/laravel-s-test/storage/laravels.sock weight=5 max_fails=3 fail_timeout=30s;
    #server 192.168.1.1:5200 weight=3 max_fails=3 fail_timeout=30s;
    #server 192.168.1.2:5200 backup;
    keepalive 16;
}

 

server 模块内最后加上以下内容:

location / {
        try_files $uri @laravels;
    }
    location @laravels {
        # proxy_connect_timeout 60s;
        # proxy_send_timeout 60s;
        # proxy_read_timeout 120s;
        proxy_http_version 1.1;
        proxy_set_header Connection "";
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Real-PORT $remote_port;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header Scheme $scheme;
        proxy_set_header Server-Protocol $server_protocol;
        proxy_set_header Server-Name $server_name;
        proxy_set_header Server-Addr $server_addr;
        proxy_set_header Server-Port $server_port;
        # “swoole”是指upstream
        proxy_pass http://swoole;
    }

 

设置网站运行目录:

httpswww.codefec.comuploadsimagestopic71108bf9f3cbc6a35564b124489fe380.png

二、反向代理

uploadsimagestopicd2b5ca33bd970f64a6301fa75ae2eb22CjZxIzGS.png

访问网站

截止到此,网站就可以了访问了

然后访问站点后台(通过安装脚本安装完成后会告诉你后台地址)

上传插件: https://github.com/zhuchunshu/CodeFec-SuperConfig/archive/refs/tags/1.0.zip

uploadsimagestopicd2b5ca33bd970f64a6301fa75ae2eb22O5JjrIrP.png

启用后配置发信邮箱

uploadsimagestopicd2b5ca33bd970f64a6301fa75ae2eb22XobKMmVb.png

配置站点

下图中这三项设置,挨个配置并保存一遍

httpswww.codefec.comuploadsimagestopiccbd2aad1d798e8e70bbd55c041375e5e.png

其他问题

宝塔默认的nginx配置有问题

如果保存网站配置报错,请修改nginx配置为:

user  www www;
worker_processes auto;
error_log  /www/wwwlogs/nginx_error.log  crit;
pid        /www/server/nginx/logs/nginx.pid;
worker_rlimit_nofile 51200;

events
    {
        use epoll;
        worker_connections 51200;
        multi_accept on;
    }

http
    {
        include       mime.types;
		#include luawaf.conf;

		include proxy.conf;

        default_type  application/octet-stream;

        server_names_hash_bucket_size 512;
        client_header_buffer_size 32k;
        large_client_header_buffers 4 32k;
        client_max_body_size 50m;

        sendfile   on;
        tcp_nopush on;

        keepalive_timeout 60;

        tcp_nodelay on;

        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
        fastcgi_buffer_size 64k;
        fastcgi_buffers 4 64k;
        fastcgi_busy_buffers_size 128k;
        fastcgi_temp_file_write_size 256k;
		fastcgi_intercept_errors on;

  

        limit_conn_zone $binary_remote_addr zone=perip:10m;
		limit_conn_zone $server_name zone=perserver:10m;

        server_tokens off;
        access_log off;

server
    {
        listen 888;
        server_name www.bt.cn;
        index index.html index.htm index.php;
        root  /www/server/phpmyadmin;
            location ~ /tmp/ {
                return 403;
            }

        #error_page   404   /404.html;
        include enable-php.conf;

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }

        location ~ /\.
        {
            deny all;
        }

        access_log  /www/wwwlogs/access.log;
    }
include /www/server/panel/vhost/nginx/*.conf;
}


 

版权声明:
作者:盛夏
链接:https://www.aimyy.cn/219.html
来源:黑马博客
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
打赏
< <上一篇
下一篇>>
文章目录
关闭