1

So I'm working with a fresh install of apache2 from the repos on Ubuntu 14.04.3. For unrelated reasons, the machine is already serving other things on port 80, so I want Apache to serve on a different port. However, publicly I want Apache to serve on port 80. Simple enough, set up a port forward from the router to port 8000 on the machine. I changed the 80 in ports.conf and 000-default.conf to 8000 and boom, it's serving just fine.

However, occasionally, I will type in the url http://my.hostname.com/asdf and it will redirect me to http://my.hostname.com:8000/asdf, which isn't anything because the router isn't forwarding any traffic on port 8000. Why is Apache doing this, and how can I make it stop?

2
  • Oh, It's risk. Stop, don't use another Port for webserever. It's security hole. Use same 80 port. Mar 3, 2016 at 23:54
  • Can you explain this further? What are the security risks involved in this situation?
    – lpreams
    Mar 4, 2016 at 8:45

1 Answer 1

1

Apache doesn't perform redirections unless it's instructed to do so. The redirect is likely coming from somewhere in your application.

2
  • There are no other applications other than Apache and whatever it uses. dd-wrt is forwarding public port 80 to port 8000 on the server, and Apache is listening on port 8000. When I go to my.hostname.com, it sometimes will redirect to my.hostname.com:8000, which is invalid. What's more, I'm migrating from lighttpd (which I'm sure isn't running), and it was previously in the exact same setup. The redirection only started happening when I stopped lighttpd and started apache2
    – lpreams
    Mar 3, 2016 at 22:52
  • He us talking about whatever is handling "/asdf" Is it static html? A PHP app? Assuming it isn't static html, you need tell the app that redirects should use port 80 rather then the SERVER_PORT that apache is providing the app. Mar 4, 2016 at 0:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .