Web Hosting Talk







View Full Version : Apache Question


chrisb
12-25-2002, 04:15 AM
I have all of my cgi and pl scripts running from my cgi-bin, but .txt and other text files now won't display. What could be wrong?

I'm running Linux with suEXEC. I've tried every possible chmod and owner and group permissions; and still the text files in my /var/www/cgi-bin won't display. Files in /var/www/html display fine. Any ideas?

Website Rob
12-25-2002, 04:58 AM
By definition, anything within the "cgi-bin" dir. is a script. Turn your 'txt" files into one or have them called by a script and no problems. :D

chrisb
12-25-2002, 05:30 AM
Originally posted by Website Rob
By definition, anything within the "cgi-bin" dir. is a script. Turn your 'txt" files into one or have them called by a script and no problems. :D

Huh? Is this the default behavior?

Anyway, not even a AddHandler directive will work; and that shouldn't be necessary anyway. Those text files used to display from that cgi-bin directory. I must've screwed something up when I redid primary group and groups on my VPS setup. Wish I knew what I changed. :(

BTW, with suexec, should the primary group be the same as the user, such as root root, and apache apache?

This group thing with primary and secondary groups is the hardest part of all at setting up Apache.

Website Rob
12-25-2002, 05:46 AM
I wish I knew what you changed as well. ;)

As stated, by definition it must a script within the "cgi-bin" or a file called by a script, and if you check your Error logs (even just in Cpanel) you'll probably see this msg.: file has no execute permission for those "txt" files you are trying to execute.

User files should always be: user user and if you upload in FTP, that's the way they will be be.

All of the above presumes a default or usual setup of Apache BTW.

iago
12-25-2002, 05:13 PM
Why do you want to display text files located in a cgi-bin directory? :( Just place them in other directory. If the text files need to be readen by the scripts just set the necessary permissions. You wont be able to see the text file in this directory, if you do, then something is really wrong.

Also, dont make the mistake on running your cgis as root.root, Thats an enormous security risk, do so if you know what you are doing but double check your scripts and set right permissions first

Regards

rcs
12-25-2002, 06:56 PM
If you add ScriptAlias to cgi-bin then .txt files won't run there! default.

What was before, I can only guess.. that you didn't have a ScriptAlias and only AddHandler for the cgi, so the cgi-bin dir was just another directory, and your cgi scripts run because they had a .pl or .cgi ending (accourding to your AddHandler)

chrisb
12-26-2002, 04:01 AM
Thanks for that info, guys. No, I'm running my www and cgi-bin under apache and apache with suEXEC. I hope that's correct, or maybe I should be using my username?

I just wanted to run my cgi log text files in the same directory as the cgi, that's all, or at least off of a subdir of it... easy for me to keep up with that way.

Got any suggestions for what secondary groups I should be running under root, apache, and my_username? I can't find this info anywhere.

i am a
12-26-2002, 05:28 AM
a little confused here. are all your files under your web directory owned by apache.apache?

if so, and you're running suexec, that could be a bad idea, any security holes in your script could result in malicious code that could affect files owned by apache.

i'm assuming it's a default config, so apache is running as "nobody.nobody" right?

should probably just use your username for file ownerships, and the default group, unless you need anything specific. suexec has a lot of specific "requirements" to run, so if you get ye olde ISE 500, just check the suexec_log for details, it's pretty specific.

rcs
12-26-2002, 08:08 AM
Originally posted by chrisb

Got any suggestions for what secondary groups I should be running under root, apache, and my_username? I can't find this info anywhere.

Can you explain the question please

iago
12-26-2002, 12:54 PM
im totally lost now! :confused:

Why would you want to place your log files inside a cgi-bin directory? Also about your text files if you want to be able to see them even if they are placed inside cgi-bin you can use some script to grab the file and display it as an output.

Why not place that log and text files in a protected directory outside cgi-bin.

About the ownsership it should be best to run everything as an unprivileged user.

chrisb
12-28-2002, 07:07 PM
Sorry, I haven't been back lately. I've had a more pressing problem. I screwed up bind (named) somehow and it won't load. I can ping with an address but not with a name. I have "127.0.0.1 mydomainname.com localhost" in /etc/hosts and have changed groups, ownership and permissions and it still fails.

chrisb
12-28-2002, 08:23 PM
I finally got bind running and host names resolving. I had to add a forwarder, and also I had the wrong IP address in resolv.conf that I had to change.