• docker-compose搭建discuz论坛


    1、下载discuz

    https://gitee.com/3dming/DiscuzL/attach_files

    2、目录结构

     

    3、docker-compose内容

    docker-compose.yaml

    version: '3'

    services:

      nginx:

        container_name: discuz_nginx

        image: leleos/nginx:1.15.7-alpine

        volumes:

          - /etc/localtime:/etc/localtime

          - ./web:/usr/share/nginx/html:rw

          - ./conf/nginx.conf:/etc/nginx/nginx.conf:rw

          - ./conf/fcgi-host.conf:/etc/nginx/fcgi-host.conf:rw

          - ./log:/var/log/nginx:rw

        restart: always

        links:

          - php

        ports:

          - 8080:80

        networks:

          - discuz_test_com

      php:

        container_name: discuz_php

        image: leleos/php-fpm:5.3

        restart: always

        volumes:

          - /etc/localtime:/etc/localtime

          - ./web:/usr/share/nginx/html:rw

          - ./log:/var/log/phplog

        environment:

          NEW_UID: 1000

          NEW_GID: 1000

        networks:

          - discuz_test_com

    networks:

      discuz_test_com:

    4、拷贝discuz论坛代码

    cp -r upload/* /data/discuz/web/

    5、nginx配置文件,php配置文件

    fcgi-host.conf内容:

    fastcgi_param GATEWAY_INTERFACE CGI/1.1;
    fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

    fastcgi_param QUERY_STRING $query_string;
    fastcgi_param REQUEST_METHOD $request_method;
    fastcgi_param CONTENT_TYPE $content_type;
    fastcgi_param CONTENT_LENGTH $content_length;

    #fastcgi_param SCRIPT_FILENAME /web$fastcgi_script_name;
    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
    fastcgi_param REQUEST_URI $request_uri;
    fastcgi_param DOCUMENT_URI $document_uri;
    fastcgi_param DOCUMENT_ROOT $document_root;
    fastcgi_param SERVER_PROTOCOL $server_protocol;
    fastcgi_param HTTPS $https if_not_empty;

    fastcgi_param REMOTE_ADDR $remote_addr;
    fastcgi_param REMOTE_PORT $remote_port;
    fastcgi_param SERVER_ADDR $server_addr;
    fastcgi_param SERVER_PORT $server_port;
    fastcgi_param SERVER_NAME $server_name;

    # PHP only, required if PHP was built with --enable-force-cgi-redirect
    fastcgi_param REDIRECT_STATUS 200;

    nginx.conf内容

    http {

        include       /etc/nginx/mime.types;

        default_type  application/octet-stream;

               server_names_hash_bucket_size 128;

        client_header_buffer_size 32k;

        client_body_buffer_size 1024k;

        large_client_header_buffers 4 32k;

        client_max_body_size 500m;

        sendfile on;

               tcp_nopush on;

               keepalive_timeout 60 60;

               fastcgi_connect_timeout 300;

               fastcgi_send_timeout 300;

               fastcgi_read_timeout 300;

               fastcgi_buffer_size 32k;

               fastcgi_buffers 8 32k;

               fastcgi_busy_buffers_size 32k;

               fastcgi_temp_file_write_size 32k;

               fastcgi_intercept_errors on;

        tcp_nodelay on;

               server_tokens off;

               gzip             on;

               gzip_min_length  1000;

               gzip_proxied     expired no-cache no-store private auth;

               gzip_types       text/plain text/css text/xml text/javascript application/x-javascript application/xml application/rss+xml application/xhtml+xml application/atom_xml;

               gzip_disable     "MSIE [1-6].(?!.*SV1)";

               log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '

                            '$status $body_bytes_sent "$http_referer" '

                                   '"$http_user_agent" $http_x_forwarded_for';

    server {

        listen       80;

        index index.html index.htm index.php;

        set $subdomain '';

        root  /usr/share/nginx/html$subdomain;

        location ~ .*.php$ {

            fastcgi_pass  php:9000;

            fastcgi_index index.php;

            include /etc/nginx/fcgi-host.conf;

            fastcgi_param DOCUMENT_ROOT  /usr/share/nginx/html$subdomain;

            fastcgi_param SCRIPT_FILENAME  /usr/share/nginx/html$subdomain$fastcgi_script_name;

        }

        location ~ .*.(gif|jpg|jpeg|png|bmp|swf|flv|mp3|wma)$ {

            expires      30d;

        }

        location ~ .*.(js|css)$ {

            expires      12h;

        }

    }

    }

    6、设置目录权限

    chmod -R 777 config

    chmod -R 777 data

    chmod -R 777 uc_client

    chmod -R 777 uc_server

  • 相关阅读:
    swoole创建进程
    php中,posix_getpid() 和 getmypid() 有什么不同
    php查看进程
    初探PHP多进程
    nginx转发
    mime类型
    acwing 517. 信息传递
    LeetCode 1255 得分最高的单词集合 Maximum Score Words Formed by Letters
    LEETCODE 1254 统计封闭岛屿的数目 Number of Closed Islands
    算法问题实战策略 SORTGAME
  • 原文地址:https://www.cnblogs.com/qiansm/p/13566837.html
Copyright © 2020-2023  润新知