本番と開発をdocker-compose.ymlの設定で使い分けられるよう設定

このコミットが含まれているのは:
Kan Nakazawa 2021-12-14 17:48:17 +09:00
コミット 2628e14cf4
3個のファイルの変更56行の追加55行の削除

ファイルの表示

@ -14,7 +14,10 @@ services:
- ./backend:/work
- /etc/letsencrypt/live/kikikan.xyz:/etc/letsencrypt/live/kikikan.xyz
- /etc/letsencrypt/archive/kikikan.xyz:/etc/letsencrypt/archive/kikikan.xyz
- ./infra/nginx/default.conf:/etc/nginx/conf.d/default.conf
# 本番環境
# - ./infra/nginx/default.conf:/etc/nginx/conf.d/default.conf
# 開発環境
- ./infra/nginx/default.dev.conf:/etc/nginx/conf.d/default.conf
working_dir: /work
certbot:

ファイルの表示

@ -1,10 +1,23 @@
### 開発環境用 ###
server {
listen 80;
server_name kikikan.xyz;
# Redirect to HTTPS
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name kikikan.xyz;
root /work/public;
# SSL化
ssl_certificate /etc/letsencrypt/live/kikikan.xyz/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/kikikan.xyz/privkey.pem;
access_log /var/log/nginx/ssl-access.log;
error_log /var/log/nginx/ssl-error.log;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
@ -33,55 +46,4 @@ server {
location ~ /\.(?!well-known).* {
deny all;
}
}
### 本番環境用 ###
# server {
# listen 80;
# server_name kikikan.xyz;
# # Redirect to HTTPS
# return 301 https://$host$request_uri;
# }
# server {
# listen 443 ssl;
# server_name kikikan.xyz;
# root /work/public;
# # SSL化
# ssl_certificate /etc/letsencrypt/live/kikikan.xyz/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/kikikan.xyz/privkey.pem;
# access_log /var/log/nginx/ssl-access.log;
# error_log /var/log/nginx/ssl-error.log;
# add_header X-Frame-Options "SAMEORIGIN";
# add_header X-XSS-Protection "1; mode=block";
# add_header X-Content-Type-Options "nosniff";
# index index.php;
# charset utf-8;
# client_max_body_size 0;
# location / {
# try_files $uri $uri/ /index.php?$query_string;
# }
# location = /favicon.ico { access_log off; log_not_found off; }
# location = /robots.txt { access_log off; log_not_found off; }
# error_page 404 /index.php;
# location ~ \.php$ {
# try_files $uri =404;
# fastcgi_pass app:9000;
# fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
# include fastcgi_params;
# }
# location ~ /\.(?!well-known).* {
# deny all;
# }
# }
}

36
infra/nginx/default.dev.conf ノーマルファイル
ファイルの表示

@ -0,0 +1,36 @@
### 開発環境用 ###
server {
listen 80;
server_name kikikan.xyz;
root /work/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
client_max_body_size 0;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass app:9000;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}