I just installed Nginx as a feature of VestaCP on my VPS.
What I'm trying to do is to mask the URL http://example.com
to http://12345.com
, so when users visit http://example.com/path/file.mp4
they will see the content of http://12345.com/path/file.mp4
but browsers still show the URL http://example.com/path/file.mp4
.
I googled and found a topic here. It looks like the answer I'm looking for. However when I applied his code to nginx.conf, VestaCP showed Error: nginx failed to start with new config
and stopped working.
Here is the code:
server {
listen 80;
server_name sub.example.com;
location / {
proxy_pass https://123.12.12.12;
rewrite ^/$ /path last;
}
}
Is this the right solution for me? I'm completely new to this so I don't know if I did it correctly.
Edited: I was able to get the job done using apache .htaccess. How do I convert this to use with Nginx?
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
RewriteRule ^ http://12345.com%{REQUEST_URI} [L,NE,P]