LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Apache Outta the Box - Am I on Glue? (https://www.linuxquestions.org/questions/slackware-14/apache-outta-the-box-am-i-on-glue-576154/)

terosaur 08-10-2007 09:56 AM

Apache Outta the Box - Am I on Glue?
 
I am a complete noob to Apache, so I apologize for what may be very obvious to some of you. That's why I'm here to ask for help :)

Slackware 11.0 with Apache defaults. I can't access webpages remotely but I can right from the server itself.

I'm guessing I need to modify httpd.conf and add the particular Directory I want to allow all to access to? Is the default permissions to basically deny all access to all folders under htdocs?

I could use .htaccess, but people seem to recommend against those files..?

For example, just for testing I want to access the "manual". I can using localhost, but not from another workstation. I get server not found in Firefox.

I think i'm on the right track, just looking for a couple tips and/or confirmation.

Much appreciated.

Thanks!

gibson79 08-10-2007 10:18 AM

Do you have a router or firewall between the machines that would block access to port 80?

Not sure about trying to access the manual from a remote machine, but have you tried just accessing the default index.html page in htdocs from the remote machine?

terosaur 08-10-2007 10:33 AM

Quote:

Originally Posted by gibson79
Do you have a router or firewall between the machines that would block access to port 80?

Not sure about trying to access the manual from a remote machine, but have you tried just accessing the default index.html page in htdocs from the remote machine?


No router/firewall. I can telnet to port 80 fine. I have tried accessing the default page as well.

tobyl 08-10-2007 12:30 PM

I'm no expert, but

try running (as root on the server)

netstat -apNlt

you should see something like

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:http 0.0.0.0:* LISTEN 3638/httpd

if you do, and there is definitely no firewall messing things up,
then double check that your are entering the correct address on the remote browser.
I think if the problem was access permission you would get permission denied, whereas if you are getting 'server not found', then its more likely you are trying to connect to the wrong address.

tobyl

terosaur 08-10-2007 12:39 PM

Quote:

Originally Posted by tobyl
I'm no expert, but

try running (as root on the server)

netstat -apNlt

you should see something like

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:http 0.0.0.0:* LISTEN 3638/httpd

if you do, and there is definitely no firewall messing things up,
then double check that your are entering the correct address on the remote browser.
I think if the problem was access permission you would get permission denied, whereas if you are getting 'server not found', then its more likely you are trying to connect to the wrong address.

tobyl

There is positively no firewall. I am on my home LAN through a simple switch (hub). I can create the htdocs/phpinfo.php file and remotely access and view it just fine. But I can't remotely view anything in a subdirectory of htdocs/. It is finding the and it is allowing port 80, it's just not letting me see in other dirs. That's why I'm thinking it's the configuration of httpd.conf and being very restrictive by default so that when you install it, it doesn't just open up everything to everyone automatically. I like that philosophy. In the case of Apache, it's just not as obvious what I need to do to make this work. Thanks for helping!

BCarey 08-10-2007 02:26 PM

Quote:

Originally Posted by terosaur
There is positively no firewall. I am on my home LAN through a simple switch (hub). I can create the htdocs/phpinfo.php file and remotely access and view it just fine. But I can't remotely view anything in a subdirectory of htdocs/. It is finding the and it is allowing port 80, it's just not letting me see in other dirs. That's why I'm thinking it's the configuration of httpd.conf and being very restrictive by default so that when you install it, it doesn't just open up everything to everyone automatically. I like that philosophy. In the case of Apache, it's just not as obvious what I need to do to make this work. Thanks for helping!

Who owns the subdirectories? They must be owned by the web server user. Check the ownership of htdocs, and make sure the subdirectories and files have the same owner.

Brian

terosaur 08-10-2007 02:34 PM

Quote:

Originally Posted by BCarey
Who owns the subdirectories? They must be owned by the web server user. Check the ownership of htdocs, and make sure the subdirectories and files have the same owner.

Brian

root owns the htdocs, subdirectories and the phpinfo.php file I tested against. Completely vanilla install at this point.

Tux-Slack 08-10-2007 02:44 PM

And who is the user that runs apache?
Still if it would have been a permission error, the error message wouldn't be server not found but access denied.
Are you 10000% sure you input the right address? http://IP/subDir/document.html?

BCarey 08-10-2007 02:48 PM

Quote:

Originally Posted by terosaur
root owns the htdocs, subdirectories and the phpinfo.php file I tested against. Completely vanilla install at this point.

...and are they all world-readable?

The webserver runs with a user/group defined in httpd.conf. It is usually something like "apache" or "nobody" or "httpd". "grep User httpd.conf" will show you the current setting. Personally, I usually set all my web files to be owned by the web server user and remove global permissions.

You should not have to explicitly give permission in httpd.conf for subdirectories as long as they are readable by the web server user.

Brian

Tux-Slack 08-10-2007 03:04 PM

in my default httpd.conf user and group are set to daemon
Fresh install never modified.
So I would bet my hand he has it the same.

terosaur 08-10-2007 03:17 PM

Quote:

Originally Posted by Tux-Slack
And who is the user that runs apache?
Still if it would have been a permission error, the error message wouldn't be server not found but access denied.
Are you 10000% sure you input the right address? http://IP/subDir/document.html?

There is 1 instance of apache running as root and the others run as nobody. I am sure of the folder path. I have even tried the /manual subdir...although I can't say for certain I used index.html, but the DirectoryIndex setting in apache is index.html so that don't matter.

Thanks!

BCarey 08-10-2007 03:23 PM

Quote:

Originally Posted by Tux-Slack
in my default httpd.conf user and group are set to daemon
Fresh install never modified.
So I would bet my hand he has it the same.

That's odd...I have not changed these either, and Apache 1.x in Slack 11 defaulted to "nobody" and Apache 2 in Slack 12 defaults to "apache".

Brian

Tux-Slack 08-10-2007 03:24 PM

Yes you don't need to input index.html into the URL.
One instance for root is because you were logged in as root when you ran /etc/rc.d/rc.httpd start and the other are nobody because it is set so in httpd.conf
That is normal. But I still wouldn't belive that this is the problem with file permissions because you would not get a server not found error in the browser.
Although just to be sure, make clear that they are all publicly readable.
Go to the dir that contains htdocs and run
chmod -R 664 htdocs/
Witch will make all files and directories as read-write for file owner, same for file owner group and make it read-only for others, witch is then publicly readable.
And then you still need to fix that dirs are marked as executable witch you do with:
chmod +x htdocs
and do the same for all directoryes in htdocs a.s.o.

BCarey 08-10-2007 03:25 PM

Quote:

Originally Posted by terosaur
There is 1 instance of apache running as root and the others run as nobody. I am sure of the folder path. I have even tried the /manual subdir...although I can't say for certain I used index.html, but the DirectoryIndex setting in apache is index.html so that don't matter.

Thanks!

And have you checked the permissions? Also, try with a static html file like index.html instead of a php file to eliminate that variable. It also seems strange to me that you have an httpd process running as root. They should all be "nobody".

Brian

terosaur 08-10-2007 03:54 PM

Thanks guys, I will double-check all those things this evening.

So to confirm, I shouldn't need to specify any new sub-dirs of htdocs in the httpd.conf file?

Thanks!


All times are GMT -5. The time now is 06:42 AM.