nginx redirect domain config

Nhan Cao
Jul 21, 2023
  • DNS service (Cloudflare): New A record to your server IP
  • SSH to server new virtual domain for redirecting.

Note: Change meet.nhancv.com to your domain

# Create domain config
sudo -s
cat << 'EOF' > /etc/nginx/sites-available/meet.nhancv.com
server {
listen 80;
listen [::]:80;


server_name meet.nhancv.com;
rewrite ^/(.*)$ https://fantastical.app/nhancv/meet permanent;
}
EOF

# Register domain
sudo ln -s /etc/nginx/sites-available/meet.nhancv.com /etc/nginx/sites-enabled/
sudo nginx -t
sudo service nginx reload

# Setup ssl
sudo certbot --nginx

--

--