Answer the question
In order to leave comments, you need to log in
Why are Css loaded from the old domain?
We deploy a new subdomain new.prodject.ru. Css somehow clings to the old one. New domain nginx config
server {
listen 80;
server_name new.project.ru;
return 301 https://$host$request_uri;
error_log /var/log/nginx/nginx_prodject1.ru_error.log;
client_max_body_size 40M;
gzip on;
gzip_disable "msie6";
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
gzip_comp_level 5;
location ~ ^/cache/ {
proxy_pass http://127.0.0.1:8080;
}
location ~ ^/admin/ {
proxy_passhttp://127.0.0.1:8080;
}
location / {
proxy_pass 127.0.0.1:8080/;
proxy_read_timeout 300s;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_buffering off;
}
location ~* \.(html|jpeg|jpg|gif|png|css|js|pdf|txt|tar|ico|swf|flv|avi|djvu|mp3|mp4|3gp)$ {
root /var/www /domains/new.project.ru;
proxy_cache static_cache;
proxy_cache_valid 200 302 10m;
proxy_cache_valid 404 1m;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
Old
server config {
listen 80;
server_name prodject.ru old.prodject.ru;
return 301 https://$host$request_uri;
error_log /var/log/nginx/nginx_prodject.ru_error.log;
client_max_body_size 40M;
gzip on;
gzip_disable "msie6";
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
gzip_comp_level 5;
location ~ ^/cache/ {
proxy_pass http://127.0.0.1:8080;
}
location ~ ^/admin/ {
proxy_pass http://127.0.0.1:8080;
}
location / {
proxy_pass 127.0.0.1:8080/;
proxy_read_timeout 300s;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_buffering off;
}
location ~* \.(html|gif|png|css|js|pdf|txt|tar|ico|swf|flv|avi|djvu|mp3|mp4|3gp)$ {
root /var/www/domains/prodject .ru;
proxy_cache static_cache;
proxy_cache_valid 10m;
proxy_cache_valid 404 1m;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
Answer the question
In order to leave comments, you need to log in
The fact is that the path to the css file can refer either to a file in the same directory:
Or to a file from the main directory of the site (you need to add a slash at the beginning of the css file address):
Try adding or removing a slash when connecting a file with styles
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question