Answer the question
In order to leave comments, you need to log in
How to properly configure nginx when transferring a domain to another hosting?
I am moving to another hosting. For https I use CloudFlare Proxy. How to redirect to another hosting correctly when changing dns for a domain (so that ssl does not fall off)?
server {
listen 443 ssl;
server_name somedomain.com;
ssl on;
ssl_certificate /etc/nginx/ssl3/domain_name.chained.crt;
ssl_certificate_key /etc/nginx/ssl3/private.key;
location /images/ava/ {
alias /var/www/public/images/ava/;
}
location /nginx_status {
stub_status on;
access_log off;
allow someipaddress;
allow someipaddress;
deny all;
}
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8080;
}
}
server {
listen 80;
proxy_set_header Host somedomain.com;
location / {
rewrite ^(.*)$ https://somedomain.com$1 permanent;
}
}
server {
server_name _;
location /images/ava/ {
alias /var/www/public/images/ava/;
}
location /nginx_status {
stub_status on;
access_log off;
allow someipaddress;
allow someipaddress;
deny all;
}
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8080;
}
}
server {
listen 80;
}
<VirtualHost *:8080>
ServerAdmin [email protected]
DocumentRoot /var/www/public
ErrorLog ${APACHE_LOG_DIR}/error.log
</VirtualHost>
Answer the question
In order to leave comments, you need to log in
Just change the ip in cloudflare and everything will be fine, nothing else needs to be done
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question