Find the answer to your Linux question:
Results 1 to 6 of 6
Alright, so this may seem noob like, but how exactly would you open a port and point it to an html page, like port 80 does by default? Example: Port ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2010
    Posts
    4

    Direct Port To HTML Page


    Alright, so this may seem noob like, but how exactly would you open a port and point it to an html page, like port 80 does by default?

    Example: Port 2985 -> ./var/www/login/index.php

    Any help would be appreciated, I did some google searches and came up blank...

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,440
    You give not enough information.

    1) Do you operate a webserver already?
    If yes, what is your document root? /var/www or /var/www/login?

    2) Is this page you are trying to reach on an external server?
    You must always face the curtain with a bow.

  3. #3
    Just Joined!
    Join Date
    Oct 2010
    Posts
    4
    1. Yes, apache is currently running on port 80 going to /var/www/
    I want a separate port, like 2985 to direct to /var/www/login/

    2. This page is on a server that I rent from a company which is hosted elsewhere.
    So as an example I'd like people to type in mysite.com:2985 and view the index file in the login folder. I do know how to modify apache's config to accept a domain via virtual hosts, just don't know how to open a port to a specific folder.

    Sorry about not giving enough information, I'm kind of new to this...

  4. $spacer_open
    $spacer_close
  5. #4
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,440
    Well, the first thing that comes to mind.
    Why this port solution?
    Usually, a link named "login" on the site directing to login/index.php should do.

    Using a different port than the usual 80 or 443 might lead to problems,
    as non-standard http ports might be blocked by external firewalls, so you might indirectly block wanted visitors.

    Also, are you sure, the login page can work on its own, if the DocumentRoot of an additional VirtualHost would be set to /var/www/login ?
    I am thinking links, css and js files, etc.

    It would probably be safer to setup this new VirtualHost for port 2985 as an exact clone of the existing one, in particular with the same DocRoot (you need also an additional Listen and NameVirtualHost of course)
    but define a custom DirectoryIndex for it.
    That DirectoryIndex html file would only contain a redirect to ./login/index.php


    But as I said, a link on the site on the regular port 80 site seems easier.
    You must always face the curtain with a bow.

  6. #5
    Just Joined!
    Join Date
    Oct 2010
    Posts
    4
    The reason being I'm attempting to build a control panel for my server and I'd like to have the login page separated from the default page and maybe I'll explain it a bit better....

    Using virtual hosts I'm going to add multiple domains at /var/www/users/usernamehere/public_html/ so that they can have unique file systems. The login page will always need to direct to /var/www/login/ so that all users have access to the control panel directly from their domains.

    So as an example:
    mysite.com -> /var/www/users/mysite/public_html/
    mysite.com:2985 -> /var/www/login/

    Thus a link is out of the question and simply setting up a virtualhost for the port wouldn't accomplish the desired effect. With 20 or 30 domains it would just be easier to redirect all traffic from port 2985 to /var/www/login/ than it would to enter 20 - 30 virtual host entries into the config file... Imagine with me if there were a thousand sites on the server, it'd take apache 5 minutes to start up with all of those extra entries.

  7. #6
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,440
    Thanks, now I understand better what you intend to do.

    Some solutions.
    1) Port based, as you intend.
    Set up the virtual host for the controlpanel and let it listen to 2985.
    Then add all the ServerNames of the other VirtualHosts as ServerAlias to the controlpanel host.

    2) Add an Alias to each VirtualHost
    Alias /controlpanel /var/www/login/
    should do the trick.
    So people would have to enter mysite.com/controlpanel instead of a portnumber.


    Other than that, you might want to have a look at apache mod_macro.
    For multiple, but effectively identical (in terms of setup) sites, mod_macro works wonders to simplify the setup.

    I would probably go for 2) in combination with mod_macro.
    Remember: Each of your clients must be able to reach the controlpanel,
    and a non-standard port might be an issue for some of them.


    Thousands of sites on one box? Possible, but challenging.
    If these sites show more than idle usage, then splitting seems inevitable.

    I have quite the opposite: Essentially one site (although for several countries) served by about 300 machines, 60 of them being dedicated webservers
    Last edited by Irithori; 10-16-2010 at 01:46 PM.
    You must always face the curtain with a bow.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •