apache virtual host subdomains is accessable only by localhost - linux

i am try to make my pic.localhost virtual host accessible to public network(all of the internet)
now the problem is that it works only on the same machine in address pic.localhost but its not accessible even by lan network, only by the machine who runs it. what should i do?
i add and edited this files to make my pictures sub domain site:
1 - i included the httpd-vhosts file in my httpd.conf file.
2 - i added to httpd-vhosts file this lines:
<VirtualHost *:80>
ServerAdmin admin#domain
DocumentRoot "/opt/lampp/htdocs/"
ServerName pic.localhost
# ServerAlias www.pic.localhost
ErrorLog "logs/picture-error_log"
CustomLog "logs/picture-access_log" common
</VirtualHost>
3 - i added this line to /etc/hosts
127.0.0.1 pic.localhost
4 - i restarted the xampp server
i am running xampp 5.6.8 on Centos 7 machine.

Centos 7 has a firewall that by default blocks some ports (including port 80).
in the comand line, with sudo privileges try..
service firewalld stop
then in the terminal see you CENTOS LAN IP (ifconfig) and try to access that ip (ex 192.168.1.100).
if you are able to access the web-server. then try from another machine and in the browser tipe http://centos-lan-ip where centos-lan-ip is your centos machine IP.
Hope this works

Related

Issues getting Apache VirtualHost to properly Map

I'm setting up a docker container on a linux server and I'm trying to set up a VirtualHost so that when I visit the domain I own it will show that website.
I have a DNS record on my domain to use the IP address of my linux server, and I installed apache on there to test and it worked properly.
If I start my container with
docker run -dit --name web-app -p 8080:80 web-image
I can go to mydomain.com:8080 and see my website, but it doesn't work if I just navigate to mydomain.com.
My VirtualHost stanza in httpd.conf is
<VirtualHost *:80>
ServerAdmin admin#mydomain.com
ServerName mydomain.com
ServerAlias mydomain.com
DocumentRoot /usr/local/apache2/htdocs
</VirtualHost>
The only thing I can think is that I need to update my domain DNS definition to accept the Docker Container IP address?
Is there something I'm missing?
It's quite obvious, that the website is available on port 8080, but not port 80, since you define -p 8080:80. You need to expose port 80 instead.
docker run -dit --name web-app -p 80:80 web-image

Provision headers are shown error in google chrome when using apache virtual host

I have to tomcat servers running in my server. And I wanted to do a virtual host routing. So initially I tried it with one tomcat which is running in 8081 port and ajp port enabled to 8011 in the tomcat server.xml file
My conf file in the /etc/apache2/sites-available/mydomain_name.com.conf looks likes this
<VirtualHost *:80>
ProxyRequests off
ProxyPreserveHost On
ServerName mydomain_name.com
ServerAdmin ubuntu#mydomain_name.com
ProxyPass / ajp://localhost:8011/
ProxyPassReverse / ajp://localhost:8011/
</VirtualHost>
Then I did
sudo a2ensite mydomain_name.com.conf
sudo service apache reload
Every thing went find, no issues. And I also ensured the port 8011 is listening.
But when I try to access the server from my personal laptop, the request is blocked by Google chrome.
I have enabled these configurations in the server too.
sudo a2enmod proxy
sudo a2enmod proxy_ajp
sudo a2enmod proxy_http
sudo service apache2 restar
Have anyone has came across this issue ? Shedding some light would be really helpful. Because I have done some thing similar 1 year back, then this issue did not occur, and I'm only trying to direct it to the tomcat home page. Which is a bare minimal page.
After several frustrating hours found the issue. Hope this might help if any one came across this same issue.
Although the port 80 was opened via the aws management console security groups, internally the ports were firewall protected by the ip tables. So by removing the ip-tables entry for the port 80 I was able to make the virtual host work.

How to build a simple website into a embedded Linux using Apache and Yocto?

I like to build a demo of a website running on an eval board from ATMEL. For this eval board I am building an Linux by the use of Yocto. For handling the website the apache webserver should be used.
I got the apache2 recipe build and installed, as well as my simple website. But I failed to set up the apache configuration right.
My system has two ethernet ports eth0 and eth1. Eth0 is configured to the IP 1.2.3.4 and eth1 to dchp. The index.html should be accessed through eth0. Maybe it is possible to have an literal like "mywebsite" to access it.
The website files are put in to the custom dir: /var/www/html/
Actual I am copying an virtual host config(myweb.conf) to /etc/apache2/sites-available/. It looks like:
# Ensure that Apache listens on port 80
Listen 80
<VirtualHost *:80>
ServerName mywebsite
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/
<Directory /var/www/html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost>
The yocto recipe unzips the index.html which is in myweb.zip and installs the virtual host config. The code looks like:
SUMMARY = "myweb"
SECTION = "test"
LICENSE = "CLOSED"
SRC_URI = "file://myweb.zip \
file://myweb.conf \
"
DEPENDS = "apache2"
S = "${WORKDIR}"
WWWdestPATH = "/var/www/html/"
do_install () {
install -d ${D}${WWWdestPATH}
cp -r ${S}/myweb/* ${D}${WWWdestPATH}
install -d ${D}/etc/apache2/sites-available/
cp ${S}/myweb.conf ${D}/etc/apache2/sites-available/myweb.conf
}
FILES_${PN} += "${WWWdestPATH}*"
FILES_${PN} += "/etc/apache2/sites-available/*"
Any ideas how to modify the files to get the website started?
Stefan,
If I understand you correctly you want to host web pages on the ATMEL board for clients connecting via eth0. I can't see anything obviously incorrect in your virtual host definition.
Adding mywebsite as ServerName tells Apache that that is the name for this specific virtual host - but clients still need to be able to resolve that name. Please note that if you only have a single site on the server the name doesn't matter in the Apache configuration - what matters is the DNS configuration. As long as the hostname resolves to the web server any request for any hostname would get the default site - unless there is a virtual site with a name that matches the requested host name.
What I would do is to start from the web server end and work your way out from there:
If you have included telnet in your build you could for instance access the web page directly from the command line to make sure that it answers. Do this on the ATMEL board (e.g. via ssh or if you have a display+keyboard):
telnet localhost 80 <ENTER>
GET / HTTP/1.1 <ENTER>
Host: mywebsite <ENTER><ENTER>
If that returns your web page then the web server is configured correctly.
Make sure that you can reach the ATMEL board from your client. On the client:
ping 1.2.3.4
If this doesn't work you need to put the client on the same network as the eth0 interface by setting it manually on the client or by adding a DHCP server on the ATMEL board, bound to eth0.
Make sure that the client can resolve the mywebsite host name. On the client:
ping mywebsite
If this doesn't work you need to add a DNS service (e.g. bind) to your image or, for a quick test, add the following line to the /etc/hosts file on your client (c:\windows\system32\drivers\etc\hosts if you are running Windows):
1.2.3.4 mywebsite
Hope that helps.

access a project link on ubuntu machine without port number

I have a project running on ubuntu (installed on vm machine(ipaddress-172.22.240.54) on server ), jboss server port 8180
I need to access that link via http://172.22.240.54/employeeConnect/rest(without mentioning port number)
What changes are required in httpd file and server.xml file?
You will need to add the following to your httpd.conf
ProxyPass /employeeConnect/rest http://localhost:8180/employeeConnect/rest
ProxyPassReverse /employeeConnect/rest http://localhost:8180/employeeConnect/rest

Webmin local development with name based virtualhosts

Hi i am trying to name based virtual hosts for my localhost.I was using wamp with name based virtualhost before but now im working on ubuntu.I thought webmin can be easy but when i create first virtual host all requests redirecting first virtual host even localhost,second virtualhost and phpmyadmin.
So how can i set webmin for reach each of them separately.
hosts config
127.0.0.1 www.adres1.com #working fine
127.0.0.1 adres1.com #working fine
127.0.0.1 www.adres2.com
127.0.0.1 adres2.com
Its because you are using a local server and your all domain will by default search 127.0.0.1 or your IP. So untill you declair them as CNAME in your zone file or do a entry in host file, they all will work as alias of a single domain. Thanks... :)

Resources