[英]Change URL after redirect nginx
我在 Strato 托管我的域并永久重定向到我的 linux 服务器。 这工作正常,但我想更改 URL 以便它们不是我服务器的 IP 而是原始域的名称。
因此,我调用例如www.page.de并将其重定向到 myip/outfitcreator。 但是我想要www.page.de/outfitcreator而不是 myip 。
有什么解决办法吗?
这是我的 nginx 文件
server {
listen 80;
server_name xx.xx.xxx.xxx;
location / {
root /var/www/kioskJPE/html;
index index.html;
}
location /upload {
alias /var/www/fileUpload/html/upload;
}
location /downloadfiles{
alias /var/www/fileUpload/html;
}
location /uploadFiles {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /outfitcreator {
alias /var/www/outfitcreator/html;
}
}
非常感谢!
你可能有点过于复杂了——我建议创建一个 DNS 一条记录,将你的域与你的服务器的 IP 地址联系起来,而不是进行重定向(因为它看起来并不像 Strato 中的任何东西,而是在您的 Linux 服务器上)。 DNS 记录应指向 NGINX 服务器的 IP,并且您需要将 server_name 添加到服务器块以确保正确处理
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.