-
Notifications
You must be signed in to change notification settings - Fork 8
Installation
tobiichi3227 edited this page Dec 15, 2025
·
10 revisions
git clone https://github.com/Tfcis/NTOJ
- Install
dockeranddocker-compose. - Copy scripts/.env.example to .env and setup.
-
docker compose up -dand enjoy TOJ on port 5500.
NTOJ will store some permanent data in /srv/ntoj like database, cache, problem, challenge code.
If you want to change this folder, please modify docker-compose.yml
DB_PASSWORD=DB_PASSWORD
UNLOCK_PASSWORD=UNLOCK_PASSWORD
ADMIN_NAME=admin
ADMIN_MAIL=admin@admin
ADMIN_PASSWORD=admin1234
SITE_TITLE="New TNFSH Online Judge"
TIMEDELTA=8
BASE_URL="/"If BASE_URL not equal to /, you need set web proxy like above.
# Assume BASE_URL="/oj"
location /oj {
rewrite ^/oj/(.*) /$1 break;
proxy_pass http://localhost:5500;
proxy_read_timeout 14400s;
proxy_http_version 1.1;
proxy_set_header X-Real-Ip $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}This script is tested on Ubuntu 22.04 LTS, 24.04 LTS and Debian 12.
Please create a .env file in the scripts directory.
Refer to the example file at scripts/.env.example.
The .env file should look like this:
INSTALL_DIR=/srv # Installation directory
PORT=5500
REDIS_DB=1
REDIS_HOST=localhost
DB_NAME=ntoj
DB_USERNAME=ntoj
DB_PASSWORD=DB_PASSWORD
DBHOST_OJ=localhost
UNLOCK_PASSWORD=UNLOCK_PASSWORD
ADMIN_NAME=admin
ADMIN_MAIL=admin@admin
ADMIN_PASSWORD=admin1234 # The password must be more than eight characters long and include both letters (in any case) and numbers.
SITE_TITLE="TOJ"
TIMEDELTA=8
BASE_URL="/"If BASE_URL not equal to /, you need set web proxy like above.
# Assume BASE_URL="/oj"
location /oj {
rewrite ^/oj/(.*) /$1 break;
proxy_pass http://localhost:5500;
proxy_read_timeout 14400s;
proxy_http_version 1.1;
proxy_set_header X-Real-Ip $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}cd scripts
# Set parameters
./install.shcd your_install_dir/ntoj
./runserver.sh # You can use tmux or similar tools
The default port is set to 5500.