前言#
如果你想要將 Artemis 放在伺服器上使用的話,那應該很需要反向代理
畢竟你也不想為了它而犧牲伺服器的 80/443 端口吧
需要的東西#
- 一顆清醒的大腦
- 一個已經解析到伺服器的域名
- 一台安裝了 Nginx/Caddy 的伺服器
Artemis 配置#
為了能讓反代後的 Artemis 也能正常工作,需要對 core.yaml
作出以下修改
server:
listen_address: "127.0.0.1"
hostname: "aime.example.com" #修改為你要使用域名
is_develop: False
is_using_proxy: True
proxy_port: 80
proxy_port_ssl: 443
allnet:
standalone: False
billing:
standalone: False
aimedb:
listen_address: "0.0.0.0"
完整的配置文件如下
core.yaml
server:
listen_address: "127.0.0.1"
hostname: "aime.example.com" #修改為你要使用域名
port: 8088
ssl_key: "cert/title.key"
ssl_cert: "cert/title.crt"
allow_user_registration: True
allow_unregistered_serials: True
name: "ARTEMiS"
is_develop: False
is_using_proxy: True
proxy_port: 80
proxy_port_ssl: 443
log_dir: "logs"
check_arcade_ip: False
strict_ip_checking: False
title:
loglevel: "info"
reboot_start_time: ""
reboot_end_time : ""
database:
host: "127.0.0.1"
username: "aime"
password: "password"
name: "aime"
port: 3306
protocol: "mysql"
sha2_password: False
loglevel: "info"
enable_memcached: True
memcached_host: "localhost"
frontend:
enable: False
port: 8089
loglevel: "info"
secret: ""
allnet:
standalone: False
port: 80
loglevel: "info"
allow_online_updates: False
update_cfg_folder: ""
billing:
standalone: False
loglevel: "info"
port: 8443
ssl_key: "cert/server.key"
ssl_cert: "cert/server.pem"
signing_key: "cert/billing.key"
aimedb:
enable: True
listen_address: "0.0.0.0"
loglevel: "info"
port: 22345
key: "Copyright(C)SEGA"
id_secret: ""
id_lifetime_seconds: 86400
mucha:
loglevel: "info"
Nginx 配置#
如果你需要 SSL Title Server 或者遊戲沒有打補丁的話
那麼你需要一個有效的 SSL 證書
可以使用 acme/certbot 自動申請續簽
ALL.Net#
::: warning
請使用 naominet.jp 作為 server_name
否則網路自檢將會 NG
:::
server {
listen 80;
server_name naominet.jp;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_request_headers on;
proxy_pass http://localhost:8088/;
}
}
Title#
server {
listen 80;
server_name aime.example.com; #你在 core.yaml 裡設定的 hostname
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_request_headers on;
proxy_pass http://localhost:8088/;
}
}
#如果無需SSL Title可刪除下面這段
server {
listen 443 ssl;
server_name aime.example.com;
ssl_certificate /path/to/your/certificate; #證書路徑
ssl_certificate_key /path/to/your/privatekey; #私鑰路徑
ssl_session_timeout 1d;
ssl_session_cache shared:MozSSL:10m;
ssl_session_tickets off;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers "ALL:@SECLEVEL=0";
ssl_prefer_server_ciphers off;
location / {
proxy_pass http://localhost:8088/;
}
}
Billing#
server {
listen 8443 ssl;
server_name ib.naominet.jp;
ssl_certificate /path/to/your/certificate; #證書路徑
ssl_certificate_key /path/to/your/privatekey; #私鑰路徑
ssl_session_timeout 1d;
ssl_session_cache shared:MozSSL:10m;
ssl_session_tickets off;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers "ALL:@SECLEVEL=0";
ssl_prefer_server_ciphers off;
location / {
proxy_pass http://localhost:8088/;
}
}
Caddy 配置#
參考 Nginx 配置寫的
還沒測試過,按理來說應該能跑起來
# ALL.Net
naominet.jp:80 {
reverse_proxy http://localhost:8088
}
# Title
aime.example.com:80 {
reverse_proxy http://localhost:8088
}
# SSL Title
aime.example.com:443 {
reverse_proxy http://localhost:8088
tls /path/to/your/certificate /path/to/your/privatekey
}
# Billing
ib.naominet.jp:8443 {
reverse_proxy http://localhost:8088
tls /path/to/your/certificate /path/to/your/privatekey
}
遊戲配置#
在 segatools.ini
的 default=
後寫上你前面使用的域名 (如 aime.example.com)
並確保 allnet_accounting
處於關閉狀態
此文由 Mix Space 同步更新至 xLog
原始鏈接為 https://rikka.im/posts/manual/artemis-prod