vim /etc/nginx/nginx.conf # Default config file
cd /etc/nginx/conf.d # Additional config files
Create config file for a domain:
cd /etc/nginx/conf.d
sudo vim sub.domain.ru.conf
Example of a config file:
server {
server_name sub.domain.ru;
location / {
root /var/www/sub.domain.folder;
}
}
Test config files and restart Nginx:
sudo nginx -t
sudo systemctl restart nginx
Create config file for a domain:
cd /etc/nginx/conf.d
sudo vim sub.domain.ru.conf
Example of a config file:
server {
server_name sub.domain.ru;
location / {
proxy_pass http://localhost:5000;
}
}
Test config files and restart Nginx:
sudo nginx -t
sudo systemctl restart nginx
cd /var/www/
cd /usr/share/nginx/html/
server {
rewrite ^/old/url$ https://new.domain.ru/old/url permanent;
}