1

By default when I was going to my external ip or no-ip domain I was left on the page of my internet router until I set up apache for my sites and open port 80 in the router...

My question is:
How can I configure a redirect or redirect like to my router with local ip 192.168.1.254, in apache in my server machine 192.168.1.104 ??

My objetive is create a subdomain in no-ip like router.example.com and when I access it appears the login page of my router (ip is 192.168.1.254 in my home)

I tried this:

<VirtualHost *:80>
    ServerAdmin webmaster@example.com
    ServerName router.example.com
    Redirect permanent / http://192.168.1.254

    ErrorLog ${APACHE_LOG_DIR}/router-error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/router-access.log combined

</VirtualHost>

but not working from exterior...

DiogoSaraiva
  • 389
  • 3
  • 16

1 Answers1

1

(If I am reading this correctly (and I may not be), your router is passing all traffic on port 80 forward and you can no longer hit your router's page from the outside, as all traffic 'skips' forward to your Apache server.

Based on the second half of your question I think you're looking for mod_proxy, not rewrite. Proxy will let you bounce the traffic back towards your router and serve the router control page that you intend to.

I don't have any experience with mod_proxy (I tend to go for nginx in such cases), however a cursory look at the documentation would suggest that this configuration would work:

ProxyPass / http://192.168.1.254
ProxyPassReverse / http://192.168.1.254

It may require some tweaking.

Ahrotahntee
  • 146
  • 4
  • But I can access it in my home network in 192.168.1.254, and i guess with VPN it would work?? – DiogoSaraiva Feb 02 '15 at 16:47
  • @DiogoSaraiva Sorry, I just updated my answer with some information about mod_proxy, as that appears to be what you're looking for. – Ahrotahntee Feb 02 '15 at 16:47
  • how I configure mod_proxy? Thanks... – DiogoSaraiva Feb 02 '15 at 16:48
  • @DiogoSaraiva I put a sample set of lines there, but unfortunately I don't have a lot of experience with mod_proxy. It may require some tweaks to get it to function correctly. – Ahrotahntee Feb 02 '15 at 16:51
  • * The apache2 configtest failed. Output of config test was: AH00526: Syntax error on line 4 of /etc/apache2/sites-enabled/router.conf: Invalid command 'ProxyPass', perhaps misspelled or defined by a module not included in the server configuration Action 'configtest' failed. The Apache error log may have more information. – DiogoSaraiva Feb 02 '15 at 16:52
  • gave me that error... – DiogoSaraiva Feb 02 '15 at 16:53
  • @DiogoSaraiva looks like you don't have mod_proxy installed/enabled. Check the documentation [here](http://httpd.apache.org/docs/2.2/mod/mod_proxy.html) – Ahrotahntee Feb 02 '15 at 16:53
  • looks a little insecure for me... I will give up... thanks for your help – DiogoSaraiva Feb 02 '15 at 16:56