diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bd973f2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ + +# Gnuboard core (install separately) +gnuboard/ + +# Test files +*.txt +*.png + +# Local data +data/ diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..830f61c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,47 @@ +version: '3.8' + +services: + nginx: + image: nginx:alpine + container_name: gnuboard-nginx + ports: + - "8080:80" + volumes: + - ./gnuboard:/var/www/html:Z + - ./docker/nginx.conf:/etc/nginx/conf.d/default.conf:ro,Z + depends_on: + - php + networks: + - gnuboard-net + + php: + build: + context: ./docker + dockerfile: Dockerfile.php + container_name: gnuboard-php + volumes: + - ./gnuboard:/var/www/html:Z + - ./extend:/var/www/html/extend:Z + working_dir: /var/www/html + networks: + - gnuboard-net + + mariadb: + image: mariadb:10.11 + container_name: gnuboard-db + environment: + MYSQL_ROOT_PASSWORD: rootpass + MYSQL_DATABASE: gnuboard + MYSQL_USER: gnuboard + MYSQL_PASSWORD: gnuboard123 + volumes: + - gnuboard-db:/var/lib/mysql:Z + networks: + - gnuboard-net + +networks: + gnuboard-net: + driver: bridge + +volumes: + gnuboard-db: diff --git a/docker/Dockerfile.php b/docker/Dockerfile.php new file mode 100644 index 0000000..417601c --- /dev/null +++ b/docker/Dockerfile.php @@ -0,0 +1,38 @@ +FROM php:8.1-fpm-alpine + +# 필수 패키지 설치 +RUN apk add --no-cache \ + freetype-dev \ + libjpeg-turbo-dev \ + libpng-dev \ + libwebp-dev \ + libzip-dev \ + icu-dev \ + oniguruma-dev \ + $PHPIZE_DEPS + +# PHP 확장 설치 +RUN docker-php-ext-configure gd \ + --with-freetype \ + --with-jpeg \ + --with-webp \ + && docker-php-ext-install -j$(nproc) \ + gd \ + mysqli \ + pdo_mysql \ + zip \ + intl \ + mbstring \ + fileinfo \ + opcache + +# Composer 설치 +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer + +# PHP 설정 +RUN echo "upload_max_filesize = 50M" > /usr/local/etc/php/conf.d/uploads.ini \ + && echo "post_max_size = 50M" >> /usr/local/etc/php/conf.d/uploads.ini \ + && echo "memory_limit = 256M" >> /usr/local/etc/php/conf.d/uploads.ini \ + && echo "max_execution_time = 300" >> /usr/local/etc/php/conf.d/uploads.ini + +WORKDIR /var/www/html diff --git a/docker/nginx.conf b/docker/nginx.conf new file mode 100644 index 0000000..ccef9c7 --- /dev/null +++ b/docker/nginx.conf @@ -0,0 +1,41 @@ +server { + listen 80; + server_name localhost; + root /var/www/html; + index index.php index.html; + + charset utf-8; + + # 그누보드 rewrite 규칙 + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + # PHP 처리 + location ~ \.php$ { + fastcgi_pass php:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + fastcgi_read_timeout 300; + } + + # 정적 파일 캐싱 + location ~* \.(jpg|jpeg|png|gif|ico|css|js|woff|woff2)$ { + expires 30d; + add_header Cache-Control "public, immutable"; + } + + # 보안: 숨김 파일 차단 + location ~ /\. { + deny all; + } + + # 보안: data 폴더 PHP 실행 차단 + location ~* ^/data/.*\.php$ { + deny all; + } + + # 업로드 크기 제한 + client_max_body_size 50M; +} diff --git a/extend/.htaccess b/extend/.htaccess new file mode 100644 index 0000000..05196c0 --- /dev/null +++ b/extend/.htaccess @@ -0,0 +1 @@ +# .htaccess diff --git a/extend/debugbar.extend.php b/extend/debugbar.extend.php new file mode 100644 index 0000000..e1a5163 --- /dev/null +++ b/extend/debugbar.extend.php @@ -0,0 +1,20 @@ +no_profile'); + +define('G5_USE_MEMBER_IMAGE_FILETIME', TRUE); + +// 썸네일 처리 방식, 비율유지 하지 않고 썸네일을 생성하려면 주석을 풀고 값은 false 입력합니다. ( true 또는 주석으로 된 경우에는 비율 유지합니다. ) +//define('G5_USE_THUMB_RATIO', false); \ No newline at end of file diff --git a/extend/g5_54version_update.extend.php b/extend/g5_54version_update.extend.php new file mode 100644 index 0000000..b3188ac --- /dev/null +++ b/extend/g5_54version_update.extend.php @@ -0,0 +1,69 @@ +'', 'cf_datetime'=>'', 'cf_phone'=>''); + +if (!empty($config['cf_sms_use'])) { + + $sms5 = sql_fetch("select * from {$g5['sms5_config_table']} ", false); + + // Demo 설정 + if (file_exists(G5_PATH.'/DEMO')) + { + // 받는 번호를 010-000-0000 으로 만듭니다. + $g5['sms5_demo'] = true; + + // 아이코드에 실제로 보내지 않고 가상(Random)으로 전송결과를 저장합니다. + $g5['sms5_demo_send'] = true; + } +} \ No newline at end of file diff --git a/extend/social_login.extend.php b/extend/social_login.extend.php new file mode 100644 index 0000000..8b8872b --- /dev/null +++ b/extend/social_login.extend.php @@ -0,0 +1,47 @@ + "auto", + "version" => "latest", + "endpoint" => R2_ENDPOINT, + "credentials" => [ + "key" => R2_ACCESS_KEY_ID, + "secret" => R2_SECRET_ACCESS_KEY, + ], + "use_path_style_endpoint" => true, + ]); + + $result = $client->listObjectsV2([ + "Bucket" => R2_BUCKET_NAME, + "MaxKeys" => 100, + ]); + + $contents = $result->get("Contents") ?? []; + echo "=== R2 버킷 파일 목록 ===\n\n"; + foreach ($contents as $obj) { + echo $obj["Key"] . " (" . number_format($obj["Size"]) . " bytes)\n"; + } + echo "\n총 " . count($contents) . "개 파일\n"; +} catch (Exception $e) { + echo "Error: " . $e->getMessage() . "\n"; +}