Having a problem with IIS to redirect URL to specific site.
Setup in IIS :
servername: webserver1
Sites in webserver1:
Default Site :https port 443
site2 :https port 2222
site3 :https port 3333
I created A host DNS record named: site2 that poiting to webserver1
Problem+want to achieve:
when I type in URL: https://site2 I want to reach the site2 that on port 2222
The problem is when I type now site2 I reach to the default web site on port 443 ranther than site2. Of course If I type: https://site2:2222 everything works fine.
How can I redirect so I'll only have to type site2 and it will start the site2 over port 2222 ?
Thanks in Advance.
Related
I have a domain example.com that i am trying to set up with caddy as a reverse proxy as well as static file host.
I have set up an a record pointing to the host ip with a wildcard record *
In my caddyfile i have this:
example.com {
root * somefiles
file_server
}
subdomain.example.com {
reverse_proxy 127.0.0.1:someport
}
I disabled ufw for this test
When i access example.com, i get an NXDOMAIN error. Pinging example.com gives me a host not found exception. However, accessing subdomain.example.com works fine and pinging it reveals the underlying ip
Anyone know the cause of this?
I have a somewhat weird problem on my IIS server, running a ASP.NET Core application.
The server runs correctly when there is a binding with an empty host name (wildcard). The localhost and domain name can access it correctly using this method. When putting a localhost binding only, it works on localhost, however, when putting my host name (www.mywebsite.com, mywebsite.com), accessing the website using the domain name results in an error 404.
I tried to configure my hosts file as far as I can:
127.0.0.1 localhost
::1 localhost
127.0.0.1 mywebsite.com
127.0.0.1 www.mywebsite.com
::1 mywebsite.com
::1 www.mywebsite.com
(obviously replace mywebsite.com by the real domain name)
Thanks!
I have a domain..
sub.example.com, which you can reach via port 80.
Everytime a user is searching for that Domain, I want to get an redirect to port 8096, but the user should not realize that.
Does anyone have a suggestion for this how to configure a vHost?
You can use redirect to port 80 to 8096 or use Proxy configuration.
For me the better is the Proxy because the client not view your port 8096 in his web browser
Example to Proxy configuration :
Firts make sure apache listen on port 8096 :
netstat -laputen|grep 8096
If you have no reply, check Listen port in /etc/apache2/ports.conf :
Listen 8096
Restart apache and recheck LISTEN in netstat
service apache2 restart
netstat -laputen|grep 8096
If is not apache who listen the port 8096, you just need to create vhost to listen on port 80, not 8096
Enable proxy module in apache2 :
a2enmod proxy proxy_http
Restart apache :
service apache2 restart
Create Virtual Host :
/etc/apache2/sites-available/sub2_example_com.conf
<VirtualHost *:80>
# Just listen to sub2.example.com, the others sub-domain going to the default Vhost
ServerName sub2.example.com
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8096/
ProxyPassReverse / http://127.0.0.1:8096/
</VirtualHost>
# Just if is not another app who listening to port 8096
<VirtualHost *:8096>
ServerName sub2.example.com
ServerAdmin webmaster#example.com
DocumentRoot /var/www/my_website
ErrorLog ${APACHE_LOG_DIR}/my_website_error.log
CustomLog ${APACHE_LOG_DIR}/my_website_access.log combined
</VirtualHost>
Enable Virtual Host :
a2ensite sub2_example_com.conf
Reload Apache :
service apache2 reload
Open your web browser in sub2.example.com , apache redirect all request in port 8096
Doc apache :
https://httpd.apache.org/docs/current/mod/mod_proxy.html
This question already has an answer here:
.htaccess specific URL to different port
(1 answer)
Closed 9 days ago.
I want to redirect mysite.com:8080 to mysite.com with htaccess any ideas?
It is not possible with htaccess at all. This is possible with root users' permission or if the user running the apache server is in sudoers list. Port 80 is protected from rest of the users.
You can use iptables to forward requests from port 8080 to 80. That way, both mysite.com:8080 and mysite.com will work. Another option would be to set the server to listen at port 80 as well. The latter can be done by adding:
Listen 80
in apache's configuration files.
I am attempting to setup a web server and I'm not sure where to proceed troubleshooting. Here's where I am at:
I installed apache
I pointed my domain to afraid.org (Dynamic DNS service) and installed their software on the server
Enabled port forwarding on my router for HTTP (80) VNC (5500), SSH (22). As well as enabled DMZ host for the server. My router is a Westell 7500.
The server hosts on the local network appropriately using both the the server's IP or my domain -- which I believe indicates the Dynamic DNS is working. However I cannot access the website on another network.
Here are the contents for my ports.conf file:
NameVirtualHost *:80
Listen 80
<IfModule mod_ssl.c>
# If you add NameVirtualHost *:443 here, you will also have to change
# the VirtualHost statement in /etc/apache2/sites-available/default-ssl
# to <VirtualHost *:443>
# Server Name Indication for SSL named virtual hosts is currently not
# supported by MSIE on Windows XP.
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>`
Check configuration of iptables. And also check if virtual server is properly configured to accept connections from outside.