Here I summarize a short and quick way to install Trojan-GFW Server on Ubuntu Linux.
The operating system I use is Ubuntu 20.04 but it can also be used on Debian.
sudo su
apt update
install nginx web server
apt install nginx
Configure nginx edit file /etc/nginx/sites-available/default
vi /etc/nginx/sites-available/default
replace _ in line server_name _; with your domain name; e.g. hahahaha.com
copy default file index.nginx-debian.html to index.html
cp /var/www/html/index.nginx-debian.html /var/www/html/index.html
run nginx server
systemctl start nginx
check if nginx server is running well, use browser or curl
curl hahahaha.com
install and configure certbot
apt install certbot python3-certbot-nginx
configure certybot
certbot certonly --nginx
enter email address and accept licence
on part : Which names would you like to activate HTTPS for?
enter the server number that will be given the certificate
then the certificates will be stored in /etc/letsencrypt/live/hahahaha.com/
ls -la /etc/letsencrypt/live/hahahaha.com/
fix the file permissions
chmod +rx /etc/letsencrypt/live
chmod +rx /etc/letsencrypt/archive
chmod -R +r /etc/letsencrypt/archive/hahahaha.com
install trojan
apt install trojan
configure trojan edit file config.json
vi /etc/trojan/config.json
"run_type": "server",
delete password1
replace password2 with the desired password, for example 123
edit the cert section, replace the contents with the certificate from certbot
"cert": "/path/to/certificate.crt",
"key": "/path/to/private.key",
become
"cert": "/etc/letsencrypt/live/hahahaha.com/fullchain.pem",
"key": "/etc/letsencrypt/live/hahahaha.com/privkey.pem",
enable trojan service
systemctl enable trojan
run trojan service
systemctl start trojan
check trojan service status see if there is an error.
systemctl status trojan
check service status, trojan on port 443 and nginx on port 80
ss -tulpn
.