webpage cannot be accessed from other computer - apache

I'm a newbie in httpd and my problem is I cannot access my webpage from other computer.
What I am trying to do is deploying with minimal httpd.conf file with following https://www.youtube.com/watch?v=1ZioHruINOA.
/etc/httpd/conf/httpd.conf is
Listen 0.0.0.0:80
User apache
Group apache
ServerName www.example.com
ErrorLog /var/log/httpd/error.log
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule dir_module modules/mod_dir.so
DirectoryIndex index.html
DocumentRoot /var/www/html
<Directory /var/www/html>
AllowOverride None
Order allow,deny
allow from all
</Directory>
after I run command
sudo apachectl start
w3m 172.31.30.53
I can see the desired webpage(/var/www/html/index.html)
However, running command
w3m 172.31.30.53
on other computer's terminal does not work.
Thank you in advance.
edit1:
sudo ufw status
Status: active
To Action From
-- ------ ----
Apache Full ALLOW Anywhere
22 ALLOW Anywhere
80 ALLOW Anywhere
Anywhere ALLOW 0.0.0.0
Apache Full (v6) ALLOW Anywhere (v6)
22 (v6) ALLOW Anywhere (v6)
80 (v6) ALLOW Anywhere (v6)
edit2:
/etc/apache2$ nmap 127.0.0.1
Starting Nmap 6.40 ( http://nmap.org ) at 2018-05-20 21:31 UTC
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00019s latency).
Not shown: 998 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
Nmap done: 1 IP address (1 host up) scanned in 0.91 seconds

Sounds to me that you are trying to run your webserver on a Linux machine. If you want to access your webpages from other computers, you might want to check your firewall settings. Accessing locally should work, but depending on your distro, you'll have to allow access. On Ubuntu you'll have to check ufw.
EDIT 1:
Try nmap from another machine. This way you can see what ports are available. Example: nmap yourmachine

Related

Configure IP adress in Apache in debian machine

I'm trying to setup a new site using apache in debian
BUt when I'm acessing the public domain (e.g. http://31.128.74.178:81/) I get nothing in the browser
The site contains a wordpress blog
This is the website .conf file
<VirtualHost *:81>
ServerAdmin admin#domain.com
DocumentRoot /var/www/apoint/wordpress
ServerName domain.com
<Directory /var/www/apoint/wordpress>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/domain.com_error.log
CustomLog ${APACHE_LOG_DIR}/domain.com_access.log combined
</VirtualHost>
This is the Google cloud 81 port configuration
How can i fix this?
A few scenarios you can be running into:
You don't have the proper firewall rule to allow inbound connections in port 81. If you have UFW (Uncomplicated Firewall) installed in your server, the easiest way to check this is with the command below:
sudo ufw status numbered
You should get an output like this one:
Status: active
To Action From
-- ------ ----
[ 1] OpenSSH ALLOW IN Anywhere
[ 2] 81/tcp ALLOW IN Anywhere
[ 3] OpenSSH (v6) ALLOW IN Anywhere (v6)
[ 4] 81/tcp (v6) ALLOW IN Anywhere (v6)
If you don't see port 81 listed, then you need to allow it with the following command:
sudo ufw allow 81/tcp
In case you don't have UFW installed, here you can find a guide on how to install and enable it. Please be very cautious when enabling it, since you could lose access to the server [1].
As pointed out by John Hanley, you don't have a listener configured in the /etc/apache2/ports.conf file; in that case, you just need to add the following line in the mentioned file:
Listen 81
[1] https://linuxize.com/post/how-to-setup-a-firewall-with-ufw-on-debian-10/

VirtualHosts Not Working for Locally Hosted Apache Web Server

I have an apache web server setup on my development machine (macos sierra). The configuration I had setup has been working fine for months, but for some reason it decided to stop working today. I have to include the port number (i.e. mysite.local.com:8080) for any locally hosted site I want to navigate to. If I leave off the port number I get ERR_EMPTY_RESPONSE in the browser. The config test is passing with no errors. I haven't upgraded or changed anything on this machine (that I can recall) that would cause virtual hosts to stop working. Can anyone suggest a way to pin down what the issue is here?
FYI
sudo apachectl -S produces
VirtualHost configuration:
*:87 bto.local.tura.com (/private/etc/apache2/sites-enabled/bto.local.tura.com.conf:2)
*:8080 is a NameVirtualHost
default server mr.local.tura.com (/private/etc/apache2/sites-enabled/mr.local.tura.com.conf:1)
port 8080 namevhost mr.local.tura.com (/private/etc/apache2/sites-enabled/mr.local.tura.com.conf:1)
port 8080 namevhost optics.local.tura.com (/private/etc/apache2/sites-enabled/optics.local.tura.com.conf:1)
*:85 overstock.local.tura.com (/private/etc/apache2/sites-enabled/overstock.local.tura.com.conf:1)
*:86 static.local.tura.com (/private/etc/apache2/sites-enabled/static.local.tura.com.conf:1)
My httpd.conf:
Listen 8080
Listen 85
Listen 86
Listen 87
...
ErrorLog "/var/log/apache2/error.log"
...
Include /private/etc/apache2/sites-enabled/*.conf
An example of a vhhost config file:
<VirtualHost *:85>
ServerName overstock.local.tura.com
DocumentRoot /usr/local/web/overstock
ErrorLog /var/log/apache2/overstock.local.tura.com.error.log
CustomLog /var/log/apache2/overstock.local.tura.com.access.log "combined"
<Directory "/usr/local/web/overstock">
Order Deny,Allow
Deny from all
Allow from all
Options -Indexes +FollowSymLinks
</Directory>
LogLevel emerg
</VirtualHost>
I think you should add
Listen 80
try by changing deny from none in place of deny from all
what are errors from /var/log/apache2/error.log ,paste the content of error.log

ERR_CONNECTION_REFUSED with sll apache2.4

I'm having a problem while trying to use my ssl certificate on apache 2.4
Chrome continue to respond with : ERR_CONNECTION_REFUSED
If i try on command line :
openssl s_client -connect localhost:443 -state -debug
connect: Connection refused
connect:errno=111
I also try to check what's wrong with 443 port on firewall :
netstat -pant | grep httpd
doesn't answer answer anithing
ufw status
Status: active
To Action From
-- ------ ----
443/tcp ALLOW Anywhere
22 ALLOW Anywhere
443 ALLOW Anywhere
80 ALLOW Anywhere
443/tcp (v6) ALLOW Anywhere (v6)
22 (v6) ALLOW Anywhere (v6)
443 (v6) ALLOW Anywhere (v6)
80 (v6) ALLOW Anywhere (v6)
nmap give this feedback
nmap localhost
Starting Nmap 7.01 ( https://nmap.org ) at 2016-12-13 21:52 CET
Nmap scan report for localhost (127.0.0.1)
Host is up (0.0000050s latency).
Not shown: 997 closed ports
PORT STATE SERVICE
22/tcp open ssh
53/tcp open domain
3306/tcp open mysql
Nmap done: 1 IP address (1 host up) scanned in 1.58 seconds
if this can help you, i generated my certificate with let's encrypt using the -w webroot option this other one, wasn't ok
in apache i already enabled aendmod ssl
a2enmod ssl
Considering dependency setenvif for ssl:
Module setenvif already enabled
Considering dependency mime for ssl:
Module mime already enabled
Considering dependency socache_shmcb for ssl:
Module socache_shmcb already enabled
Module ssl already enabled
My vhost:
<VirtualHost *:443>
ServerAdmin contact#domaine.fr
ServerName domain.net
ServerAlias www.domain.net
SSLCertificateFile /etc/letsencrypt/live/domain.net/fullchain.pem
SSLCertificateFile /etc/letsencrypt/live/domain.net/chain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain.net/privkey.pem
...
My ports.conf
Listen 80
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
Your VirtualHost appears to be missing the SSLEngine directive. Try adding SSLEngine on.
See https://httpd.apache.org/docs/current/mod/mod_ssl.html#sslengine

apache2 VirtualHost on a new port not working

I just installed LAMP on my Ubuntu machine, and it works fine when I access it. I want to add a virtual host on another port, port 1337, that goes to the directory /var/www/flag-1/. In order to do this, I take the following steps:
cd /etc/apache2/sites-available/
Created a file flag-1.conf
Added contents:
<VirtualHost *:1337>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/flag-1/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
At the top of /etc/apache2/ports.conf, after Listen 80, added Listen 1337
Enabled the vhost site by doing a2ensite flag-1.conf
Reloaded apache service apache2 restart
When I access the site with port 1337, it just loads indefinitely. The default port still works fine, and I don't have UFW enabled. No errors, nothing in access.log or error.log is outstanding.
Any help is appreciated. Thanks!
Figured it out -- I was using Google Cloud Platform and they blocked port 1337, I just had to manually allow TCP through it.
If you're wondering, the command was
gcloud compute firewall-rules create allow-port-1337 --allow tcp:1337 --description="Allow port 1337 to be accessed"

Server external connection refused

I am currently using WampServer 3.04, I can connect to it using my local network IP without any problem, but when it comes to connect via the Internet I always get this response: Connection REFUSED!
I have done a lot of things:
Enable Incoming Connections on my firewall for the port 8080 (The port that I want to use)
Configured HTTPD and HTTPD-vhosts both on my current IP and the port
Enabled port forward from extenal 8080 to private 8080 to my computer IP
Enabled put Online on Wamp
Tested if my port 8080 is open and it is open.
I honestly do not have anything else to try.
My httpd-vhosts:
<VirtualHost *:8080>
ServerName 192.168.1.3
DocumentRoot c:/wamp64/www
<Directory "c:/wamp64/www/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Allow from all
</Directory>
</VirtualHost>
I also had the same issue since port 80 was used by VMware process. Hence I killed VMware process.
Run Powershell (get-process VM | stop-process -force)
Use star before &after vm
Start WAMP then goto Apache then -test port 80. If its not working then install Apache service(found below test port 80).It should solve the problem.
Regards,
Aameer