Access virtual host on apache without host redirection? - apache

I have apache 2.4 installed on Ubuntu server 14.04 and have setup different virtual host like domain1.com,domain2.com,domain3.com. The web server is meant to be accessed only from local network. So I tried to edit /windows/syste32/drivers/hosts and added line like this
192.168.1.90 domain1.com
and can now access the domain1 from that machine by simply putting domain1.com in browser. However I wonder if I can access specific virtual host on apache without editing the hosts file, I mean entering something like this in browser
192.168.1.90/domain1.com
, but this doesn't work since apache tries to retrieve content from the default host. In other words: If I know the apache server ip and virtual host domain, can I access it via browser directly?

Related

How to remotly access a custom wampserver's virtual host in a local network?

I use Wampserver 3.0.6 under windows 10 and I want to share my application between my personal PC (The host) and some other computers linked to the same home network (Clients).
I changed a line on httpd-vhosts.conf file to let the application be accessible from other machines in the network from this:
Require lacal
to this:
Require all granted
The problem is that the default virtual host (localhost) is accessible from those clients using the host's ip adress like this 192.168.###.###/ but not my customized virtualhost (tilelli on this case). Here is the content of httpd-vhosts.conf file now:
enter image description here
I tried to access it via 192.168.###.###/tilelli/ and directly via tilelli/ but didn't work.
Can anybody help me please ?
If you define a Virtual Host Servername as tilelli then Apache will serve that site when it sees that domain name in the connection request i.e. http://tilelli.
If you have a local (company) DNS Server, add that domain to it, pointing to your WAMPServers PC's IP Address. If you dont have a local DNS Server, then change the HOSTS file on the PC's that need to see this server so they know where to look for it
HOSTS FILE
192.168.xxx.yyy tilelli
You do have to change each and every one of the other PC unfortunately.

Using HOSTS to redirect browser from remote subdomain to local Apache server doesn't work

Using HOSTS to redirect browser from remote subdomain to local Apache server doesn't work
I'm trying out a method to run my websites securely on my home server, for testing, but it's not working.
I own a website on a cPanel/Apache 2.4/Linux server and I do local development on a Windows/Apache server.
I created a remote subdomain local.example.com and added it to my local HOSTS file, like this:
127.0.0.1 local.example.com
I confirmed that local.example.com is redirected locally using ping.
In my local Apache config file, I defined virtual hosts for local.example.com on Ports 80 and 443. I copied the Let's Encrypt certificates and keys from the remote server to the local server.
When I browse to either http://local.example.com or https://local.example.com, the browser looks on the remote server, not the local server.
If it is relevant, I also have a local virtual host configured for "localhost". But it denies access to the directory for local.example.com.
The funny thing is that if I change local.example.com to example.com everywhere locally, this method works perfectly, hiding example.com and running locally on the local example.com. There is something about local.example.com being a subdomain that is a problem.
ADDED the next day:
Suddenly, today, it started working, even though I made no changes. Strange.

How do I configure apache for subdomains on pi in my own local network?

I want to access multiple websites at home on my pi apache server, like this:
projectA.localhost
projectB.localhost
or :
projectA.192.168.0.24 - IP of my pi.
I have tried to add vhost, but nothing has changed.
I can redirect my /var/www/ to other places but i want have a structur like:
/var/www/websites/projectA
/var/www/websites/projectB
I do this by modifying the hosts file on machines on my LAN that will access the server. That way, there is no special magic that has to occur in Apache (meaning that the web site can be moved to a public host without re-configuration.)
For example, configure Apache as typical with virtual hosts projecta.com and projectb.com (or projecta.localhost and projectb.localhost, if you prefer). There is no special Apache configuration on the server.
On the systems that will access projecta and projectb, configure the hosts file to point to the server's IP address:
projecta.com 192.168.0.24
projectb.com 192.168.0.24
-or-
projecta.localhost 192.168.0.24
projectb.localhost 192.168.0.24
Apache will properly route requests to the appropriate site.

Remote access of network computer

I am not sure how or if this can be done. I have a home network and would like to see a computer,not the server, via a remote location. I have Apache on my server. Example: the network computers I would like to see ip 152.254.1.33. Is there a way to add this ip to Apache root directory? I have tried to add a shortcut with in the root directory and it only works on the home network, will not via remote connection.
I need some clarification here on what you are trying to acomplish, are you trying to access the Apache website outside of the local network?
If that is the case, Apache is automatically set to listen on all network interfaces, you can check this in your virtual host configuration in the sites-enabled directory of your apache installation.
You should see something like in the 000-default.conf
You can test if apache is serving pages up correctly using the command
curl 127.0.0.1
You should see the HTML of the page being served.
If this is the case, then it's likely the firewall on your machine/router or your ISP is blocking the required ports. You can allow Apache through the firewall on Ubuntu using sudo ufw allow Apache Full
If you give me some more info in comments we can probably work this out.

symlink or alias? Not sure what its called

I want to redirect request on my local webserver much like "http://localhost/" redirects to my ServerRoot. I have seen it done with "http://www/" and also with "http://helpdesk/" How would I go about adding my own?
Are you saying you want to redirect something like http://custom to your web server? If so you can do this by creating an entry in your hosts file, or configuring your local DNS server to return local addresses for those hostnames.
Add the following to your hosts file (On *nix /etc/hosts and C:\Windows\System32\drivers\etc\hosts on Windows)
127.0.0.1 custom www.custom
Then you can optionally configure a virtual host on your Apache server to handle requests for those hosts. If you don't create a virtual host, it will just serve up the same content as localhost. You can also have your local webserver host the site and add that entry to your local PC's hosts file and be able to browse it from that hostname as well.
If that isn't what you wanted, can you please clarify your question.