Learn how to a build a cloud-first strategyRegister Now


ssh tunnel to port 80 + vhosts + serveralias + virtualdocumentroot not working

Posted on 2014-08-26
Medium Priority
Last Modified: 2014-10-21
I have a remote server with all ports disabled except 22 (ssh). I use Putty to connect to the server with a forwarded port (Source port: 8080 Destination: *.*.*.*:80). When I open a browser and put localhost:8080 in I get the appropriate webpage.

Now I want to have subdomain virtual hosts like this: subdomain.localhost:8080. Subdomain being the name of a folder.

I've tried this:

<VirtualHost *:80>
        UseCanonicalName On
        ServerName sub.domain.com
        ServerAlias *.domain.com
        VirtualDocumentRoot /var/www/%1
        <Directory />
                Options FollowSymLinks
                AllowOverride All

Open in new window

When I try to access "localhost:8080" with "UseCanonicalName On" in chrome it returns "NOT FOUND Apache/2.2.16 (Debian) Server at sub.domain.com Port 80" (I figured out it tries to find an index in "sub" folder)

When it's "UseCanonicalName Off" it returns "NOT FOUND Apache/2.2.16 (Debian) Server at localhost Port 8080".  (tries to find an index in "localhost" folder).

In both cases when I try to access "sub.localhost:8080" chrome returns ERR_NAME_NOT_RESOLVED.

They seem to be separate issues. In first two cases no matter what I try it never registers ServerAlias. In the third one it doesn't seem to even make it to the server.

Can you help me with this?
Question by:Carbonecz

Author Comment

ID: 40287080
I've just found out that you can use lvho.st for localhost subdomains.

"sub.lvho.st:8080" instead of "sub.localhost:8080".

This seems to solve all issues. I don't like to rely on this website though. Is there a better solution?
LVL 51

Accepted Solution

Steve Bink earned 1500 total points
ID: 40288766
You can modify your hosts file to provide resolution for the subdomain: sub.localhost

Open in new window

The hosts file is found in /etc on *nix, and in %WINDIR%\system32\drivers\etc on Windows.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month21 days, 3 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question