You are not logged in.

#1 2010-01-15 16:45:30

pluckypigeon
Member
Registered: 2009-01-09
Posts: 86

Can't connect to Apache Server Remotely

I have set up Apache on Port 81 and I have set up port forwarding for 81 and 433 on my router but I can't seem to connect to Apache from another computer. My username is in http group.

The only way I can connect is by localhost:81

If I try ipaddress:81 I get can't establish a connection to the server.

Anyone have any ideas.

Thanks in advance!!

Offline

#2 2010-01-15 17:07:40

ruffedgz
Member
From: Michigan
Registered: 2009-07-23
Posts: 54

Re: Can't connect to Apache Server Remotely

It probably has something to do with your httpd.conf file.

Right now, you should only allow local connection to communicate to it and talk to:

<Directory "/var/www/html">

Hence why you are only able to do localhost:81 and it works. If you want a specific IP or hostname for apache to listen for, then travel to the bottom of the httpd.conf file and you should see something like this:

#<VirtualHost *:80>
#    ServerAdmin webmaster@dummy-host.example.com
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

This is an example of apache listening for anything on port 80 and all the information below is what it will do. You will want to take that for your situation, change it to port 81, have it redirect to 443 and then have another virtual host marked for port 443.

I will make an example when I get back if what I said didn't make much sense wink

Hope this helps!


Arch linux i686 | Dell XPS m1530 | Intel Core 2 Duo 2 GHz | 3 GB RAM | 250GB HDD

Offline

#3 2010-01-15 17:11:15

n0dix
Member
Registered: 2009-09-22
Posts: 956

Re: Can't connect to Apache Server Remotely

You can connect via ssh???

Offline

#4 2010-01-15 17:52:01

pluckypigeon
Member
Registered: 2009-01-09
Posts: 86

Re: Can't connect to Apache Server Remotely

ruffedgz wrote:

It probably has something to do with your httpd.conf file.

Right now, you should only allow local connection to communicate to it and talk to:

<Directory "/var/www/html">

Hence why you are only able to do localhost:81 and it works. If you want a specific IP or hostname for apache to listen for, then travel to the bottom of the httpd.conf file and you should see something like this:

#<VirtualHost *:80>
#    ServerAdmin webmaster@dummy-host.example.com
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

This is an example of apache listening for anything on port 80 and all the information below is what it will do. You will want to take that for your situation, change it to port 81, have it redirect to 443 and then have another virtual host marked for port 443.

I will make an example when I get back if what I said didn't make much sense wink

Hope this helps!

Thanks for your reply. Sorry, I'm not sure what you mean sad I couldn't find that in the http.conf

Offline

#5 2010-01-15 17:53:23

pluckypigeon
Member
Registered: 2009-01-09
Posts: 86

Re: Can't connect to Apache Server Remotely

n0dix wrote:

You can connect via ssh???

Thanks for your reply, I wasn't aware that you could connect to apache in that way smile

Offline

#6 2010-01-15 18:32:55

ruffedgz
Member
From: Michigan
Registered: 2009-07-23
Posts: 54

Re: Can't connect to Apache Server Remotely

pluckypigeon wrote:

Thanks for your reply. Sorry, I'm not sure what you mean sad I couldn't find that in the http.conf

Not a problem. I reread your post and maybe I am not getting your question fully. Do you want to view a webpage from port 81 to 433 (port 80 and 443 are the default ports for viewing web pages) or do you want to just get into your apache server to see the terminal???

Maybe give me an example or scenario of what you want to do with your Arch Linux machine that has the package 'apache' installed on it.

This might help big_smile

::SIDE NOTE::

The location of your httpd.conf file can be found in /etc/httpd/conf/


Arch linux i686 | Dell XPS m1530 | Intel Core 2 Duo 2 GHz | 3 GB RAM | 250GB HDD

Offline

#7 2010-01-15 18:42:20

pluckypigeon
Member
Registered: 2009-01-09
Posts: 86

Re: Can't connect to Apache Server Remotely

ruffedgz wrote:
pluckypigeon wrote:

Thanks for your reply. Sorry, I'm not sure what you mean sad I couldn't find that in the http.conf

Not a problem. I reread your post and maybe I am not getting your question fully. Do you want to view a webpage from port 81 to 433 (port 80 and 443 are the default ports for viewing web pages) or do you want to just get into your apache server to see the terminal???

Maybe give me an example or scenario of what you want to do with your Arch Linux machine that has the package 'apache' installed on it.

This might help big_smile

::SIDE NOTE::

The location of your httpd.conf file can be found in /etc/httpd/conf/

Sorry for all the confusion.

I just want to view Apache through a Web Browser from another machine.

I have set the port to 81 because 80 is taken by my router configuration.

If I type localhost:81 in the URL bar I can view my web server but if I type my ip address:81 it doesn't work.

Last edited by pluckypigeon (2010-01-15 18:43:16)

Offline

#8 2010-01-15 18:56:53

JuseBox
Member
Registered: 2009-11-27
Posts: 260

Re: Can't connect to Apache Server Remotely

I would say check the hosts.allow and make sure your allowing that in just like sshd.


Linux ArchLinux 3.2.8-1-ARCH
#1 SMP PREEMPT Mon Feb 27 21:51:46 CET 2012 x86_64 AMD FX(tm)-8120 Eight-Core Processor AuthenticAMD GNU/Linux
8192MB DDR3 1300MHz | Asus m5a97 | GeForce GTX 550 Ti | 120 GB SSD

Offline

#9 2010-01-15 19:04:12

ruffedgz
Member
From: Michigan
Registered: 2009-07-23
Posts: 54

Re: Can't connect to Apache Server Remotely

pluckypigeon wrote:

Sorry for all the confusion.

I just want to view Apache through a Web Browser from another machine.

I have set the port to 81 because 80 is taken by my router configuration.

If I type localhost:81 in the URL bar I can view my web server but if I type my ip address:81 it doesn't work.

No worries, this is just what I wanted. Try editing and adding to the bottom of the file /etc/httpd/conf/httpd.conf:

Listen YOUR_IP_ADDRESS:81
<VirtualHost IP_ADDRESS_HERE:81>
   ServerName YOUR_SERVER_NAME
   ServerAdmin YOUR_EMAIL_ADDRESS
   DocumentRoot PATH TO YOUR HTML FILES

   RewriteEngine On
   RewriteRule /(.*) https://YOUR_IP_ADDRESS:433/$1
</VirtualHost>

<VirtualHost IP_ADDRESS_HERE:433>
   ServerName YOUR_SERVER_NAME
   ServerAdmin YOUR_EMAIL_ADDRESS
   DocumentRoot PATH TO YOUR HTML FILES
   TransferLog /var/log/httpd/local.access.log
   ErrorLog /var/log/httpd/local.error.log
</VirtualHost>

I don't know if the 433 will be the secure part of your page but to have a cert attached to that, you will have to add a bit more to the VirtualHost related to 433 (you can read more about it at this link: http://httpd.apache.org/docs/2.0/ssl/ssl_faq.html). All the parts with CAPITAL LETTERS are parts where you will probably want to add in whatever relates to your set up.

I noticed that by default, apache hosts all of their files in /srv/http so you can place all your files in there or another location (its really up to you).

After any change to the httpd.conf file, you must restart or reload the httpd service located in /etc/rc.d/httpd

Hope this helps.

::EDIT:: What 'JuseBox' is probably a great place to check as well. If your /etc/hosts.allow or /etc/hosts.deny is in play, you want to make sure you aren't denying everything or only allowing specific things into your apache server. Good call JuseBox!

Last edited by ruffedgz (2010-01-15 19:11:39)


Arch linux i686 | Dell XPS m1530 | Intel Core 2 Duo 2 GHz | 3 GB RAM | 250GB HDD

Offline

#10 2010-01-15 19:27:11

pluckypigeon
Member
Registered: 2009-01-09
Posts: 86

Re: Can't connect to Apache Server Remotely

Thank you for all your replies but I still can't access apache from a different computer even after tweaking all these things.

Offline

#11 2010-01-15 19:44:27

ruffedgz
Member
From: Michigan
Registered: 2009-07-23
Posts: 54

Re: Can't connect to Apache Server Remotely

What does your /etc/hosts.allow and /etc/hosts.deny say?

::EDIT::

Also, I don't know if that "RewriteRule" will work in that situation since typically you want to go to a secure site... For a test, you can take out that RewriteRule from the port 81 section of your httpd.conf file. Just another thought as well when thinking about this as you aren't using the regular ports for displaying websites.

Last edited by ruffedgz (2010-01-15 19:47:44)


Arch linux i686 | Dell XPS m1530 | Intel Core 2 Duo 2 GHz | 3 GB RAM | 250GB HDD

Offline

#12 2010-01-15 19:48:44

pluckypigeon
Member
Registered: 2009-01-09
Posts: 86

Re: Can't connect to Apache Server Remotely

ruffedgz wrote:

What does your /etc/hosts.allow and /etc/hosts.deny say?

#
# /etc/hosts.deny
#
ALL: ALL: DENY
# End of file
#
# /etc/hosts.allow
#
# End of file

I tried commenting out ALL:ALL:DENY but to no avail

Offline

#13 2010-01-15 19:57:44

ruffedgz
Member
From: Michigan
Registered: 2009-07-23
Posts: 54

Re: Can't connect to Apache Server Remotely

You want to have the ALL: ALL: DENY commented out and then restart your network service (don't know what you are using but something like /etc/rc.d/network restart should work).

Also, are your web page files being held in /srv/http? If not, then make sure the owner and group is http:

$ chown -R http.http /PATH/OF/YOUR/WEBPAGES

When you make any changes to these configuration files (httpd.conf or hosts.deny/hosts.allow) do you restart the service?

Depending on what is happening, you could also see if any errors came through /var/logs/httpd/ and that might help with what is happening with outside connections.

Got to love those logs big_smile


Arch linux i686 | Dell XPS m1530 | Intel Core 2 Duo 2 GHz | 3 GB RAM | 250GB HDD

Offline

#14 2010-01-15 20:14:24

pluckypigeon
Member
Registered: 2009-01-09
Posts: 86

Re: Can't connect to Apache Server Remotely

ruffedgz wrote:

You want to have the ALL: ALL: DENY commented out and then restart your network service (don't know what you are using but something like /etc/rc.d/network restart should work).

Also, are your web page files being held in /srv/http? If not, then make sure the owner and group is http:

$ chown -R http.http /PATH/OF/YOUR/WEBPAGES

When you make any changes to these configuration files (httpd.conf or hosts.deny/hosts.allow) do you restart the service?

Depending on what is happening, you could also see if any errors came through /var/logs/httpd/ and that might help with what is happening with outside connections.

Got to love those logs big_smile

Yep, I have been restarting after each change. My webpage was held in a folder in my home directory set to username:users but I change it to http:http with no avail, I also added myself to the http group.

The logs seem to show no errors.

Offline

#15 2010-01-15 20:40:00

pluckypigeon
Member
Registered: 2009-01-09
Posts: 86

Re: Can't connect to Apache Server Remotely

I installed Monkey server and have the same problem

Offline

#16 2010-01-15 20:50:13

ruffedgz
Member
From: Michigan
Registered: 2009-07-23
Posts: 54

Re: Can't connect to Apache Server Remotely

Lets look back at the httpd.conf file and take away everything I asked you to place in it and add the following code below to see if this just displays a page:

Listen 81
<VirtualHost *:81>
   ServerName YOUR_SERVER_NAME
   ServerAdmin YOUR_EMAIL_ADDRESS
   DocumentRoot PATH TO YOUR HTML FILES
</VirtualHost>

From there, test on your computer's browser: YOUR_IP_ADDRESS:81/index.html (or whatever file you know exists on the server). By default, apache will only look for 'index.html' files so if you are using 'index.php', you will have to type it up manually to display it. To add multiple indicies, edit the httpd.conf file and find " DirectoryIndex" and add on other types to search for (just a space will do to seperate the values). Here is a link of what I am talking about: http://httpd.apache.org/docs/1.3/mod/mod_dir.html

I am just going to keep trying new things so just bare with me big_smile

Last edited by ruffedgz (2010-01-15 20:57:37)


Arch linux i686 | Dell XPS m1530 | Intel Core 2 Duo 2 GHz | 3 GB RAM | 250GB HDD

Offline

#17 2010-01-15 21:18:15

n0dix
Member
Registered: 2009-09-22
Posts: 956

Re: Can't connect to Apache Server Remotely

I recommend you to try to run Apache server in the default port 80, and when this working fine try to change to the port 81.

Offline

#18 2010-01-15 21:31:44

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: Can't connect to Apache Server Remotely

pluckypigeon wrote:
ruffedgz wrote:

What does your /etc/hosts.allow and /etc/hosts.deny say?

#
# /etc/hosts.deny
#
ALL: ALL: DENY
# End of file
#
# /etc/hosts.allow
#
# End of file

I tried commenting out ALL:ALL:DENY but to no avail

That's not the point. Everything not explicitly allowed in hosts.allow will be blocked. It has to be enabled explicitly.

httpd: ALL

Also, try to stick with what people suggest you. You shouldn't be trying B while you still didn't try A decently, as people suggested. So stick with Apache for now. If it's working on the box locally but not on your LAN there's probably nothing wrong with the setup of the web server itself.

Also, follow n0dix's suggestion - unless you already have something running on port 80, there's no need to put your server on port 81. And no, 'internet' doesn't count.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#19 2010-01-15 22:37:50

ruffedgz
Member
From: Michigan
Registered: 2009-07-23
Posts: 54

Re: Can't connect to Apache Server Remotely

Thx B, I totally forgot about adding that part to /etc/hosts.allow file.

It shouldn't really matter if its 81 or 80 as the port but it seems from a previous post, his router is already using that port for something:

I have set the port to 81 because 80 is taken by my router configuration.

We could tell apache to look at port 8080 (that is the default port for tomcat) if we really wanted to but I think it might have had something to do with
---
1. You suggestion about the hosts.allow part
2. My suggestion about the RewriteRule to move it from port 81 to 433
---
And thanks for the laugh B, love the end of your post there big_smile


Arch linux i686 | Dell XPS m1530 | Intel Core 2 Duo 2 GHz | 3 GB RAM | 250GB HDD

Offline

Board footer

Powered by FluxBB