URLs for static links turned to IP:8443 after inserting proxy_http_version to snginx.conf file
-
- Posts: 301
- Joined: Tue Dec 22, 2015 2:06 pm
URLs for static links turned to IP:8443 after inserting proxy_http_version to snginx.conf file
I had reported the issue about "upstream timed out" in log files in another topic.
Yestoday I found an answer for this issue:
http://serverfault.com/questions/647411 ... out-errors
I followed that post and inserted following two lines into my snginx.conf (I forced SSL for my domain) file:
Now my entire snginx.conf file is:
Well, after this modification of my snginx.conf file, I saw following error records in my nginx log file:
At the same time, I noticed that images in my webpages can not show up. When I check the source code, I saw the URL for the images are turned to IP:8443 mode, for example:
You can see that my server tried to render the image via the URL started with IP:8443 , which is the value of "proxy_pass" in my snginx.conf file.
If I remove the two lines mentioned above from the snginx.conf file, all these images will show up properly.
It is frustrating here. I want to solve the "upstream timed out" problem, but the solution will cause images' link changed.
Maybe I inserted that two lines to a wrong position? Maybe there is other correct answer?
Hope someone here will help me to solve this.
Thank you.
Yestoday I found an answer for this issue:
http://serverfault.com/questions/647411 ... out-errors
I followed that post and inserted following two lines into my snginx.conf (I forced SSL for my domain) file:
Code: Select all
proxy_http_version 1.1;
proxy_set_header Connection "";
Code: Select all
upstream server {
server 10.47.93.1:8080;
}
server {
listen 120.27.137.71:443 ssl http2;
server_name joomlagate.com www.joomlagate.com;
ssl on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
ssl_ciphers 'ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS;';
ssl_prefer_server_ciphers on;
ssl_session_timeout 1h;
ssl_certificate /home/user001/conf/web/ssl.joomlagate.com.pem;
ssl_certificate_key /home/user001/conf/web/ssl.joomlagate.com.key;
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/letsencrypt/live/joomlagate.com/fullchain.pem;
resolver 8.8.8.8 8.8.4.4 valid=300s;
resolver_timeout 10s;
error_log /var/log/apache2/domains/joomlagate.com.error.log error;
location / {
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_pass https://120.27.137.71:8443;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/user001/web/joomlagate.com/public_html;
access_log /var/log/apache2/domains/joomlagate.com.log combined;
access_log /var/log/apache2/domains/joomlagate.com.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
# following 4 lines added by baijianpeng
location /.well-known/acme-challenge {
default_type text/plain;
root /etc/letsencrypt/webroot;
}
location /error/ {
alias /home/user001/web/joomlagate.com/document_errors/;
}
location @fallback {
proxy_pass https://120.27.137.71:8443;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/user001/conf/web/snginx.joomlagate.com.conf*;
}
Code: Select all
root@mail:/var/log/nginx# tail error.log
2017/03/06 08:38:04 [emerg] 6905#6905: invalid port in upstream "https://120.27.137.71:8443" in /home/user001/conf/web/snginx.conf:38
2017/03/06 08:38:12 [emerg] 6907#6907: invalid port in upstream "https://120.27.137.71:8443" in /home/user001/conf/web/snginx.conf:38
Code: Select all
<img class="kavatar" src="https://120.27.137.71:8443/media/kunena/avatars/resized/size144/users/avatar62.jpg"
If I remove the two lines mentioned above from the snginx.conf file, all these images will show up properly.
It is frustrating here. I want to solve the "upstream timed out" problem, but the solution will cause images' link changed.
Maybe I inserted that two lines to a wrong position? Maybe there is other correct answer?
Hope someone here will help me to solve this.
Thank you.
Re: URLs for static links turned to IP:8443 after inserting proxy_http_version to snginx.conf file
This topic somehow connected to viewtopic.php?f=11&t=11439&start=10 ?