Web Hosting Talk







View Full Version : Good or bad?


MaB
08-31-2002, 09:07 PM
When giving the reseller the ability to add/delete websites from httpd.conf i figured, if they hit, stop or reload, then the httpd.conf script may be incomplete or damanged.

So i got to figuring, what it rewrote the httpd.conf file every time to ensure this didnt happen?

Pros:
makes sure httpd always has updated, valid configuration

Cons:
Customizing hard

There woudl be a main httpd.conf template for the top part (with all the configurations),

How would you go about rewriting each domain tho? A template like
<VirtualHost %ip%>
.....

it doesnt allow customization?

Would you be willing to sacrifice some customization to avoid this problem?

Xanthis
08-31-2002, 09:32 PM
I had a few thoughts on this while I'm developing a CP too for my company.

One way would be to verify the information and it will populate in the database as a pending task. It would perform a 'job' of rewriting the httpd.conf which is an external file to main httpd.conf file. So the main httpd.conf includes this external file.

If you were to have a gazillion users at once and one user requires modfication of httpd.conf a certain way while another user is quicker and makes the changes he needs, it may well corrupt httpd.conf after the first user performs his actions.

So I think pending jobs would be a consideration. Though the change won't be 'instant'.

I was also considering of writing the httpd.conf file from the database to a file every 30 minutes, but that would be required to restart Apache every 30 minutes.

I'd like to hear some thoughts too as I'm stumped about this.

My fear is having two many users is like too many hands in the cookie jar can get a cookie stuck :) Or the countless possibilities that a user's computer crash while in the process that server is generating the httpd.conf, directories, etc.

Maybe code it as a daemon that listens for commands to be issued the CP verifies everything before it opens the connection to the daemon for processing. . .

MaB
08-31-2002, 09:36 PM
Well i was thinking about rewriting the httpd.conf in real time, and restarting apache every 1 hour. There would also be a script that runs every mintue to check that apache is responding, if it isnt, the firs titme it will rewrite httpd.conf and restart apache, the 2nd time its donw in a row, it will just restart apache (incase the first time, it oculdnt bind to port 80) and the 3rd time will email/text message an admins cell phone.

But there is still the problem of per domain customizations.

Xanthis
08-31-2002, 10:41 PM
Hmmm, how about adding an extra field into the database in which generates the httpd.conf which can be used to store custom VH directives.

Perhaps a checkbox status in the admin panel that if check, when the httpd.conf is generated, it either appends the custom data in the extra field within the VH container or rewrite the entire VH contain. . .

UH-Matt
09-01-2002, 06:12 PM
How about giving each reseller there own file for httpd.conf additions and simply using an include in the main file to there own little file, that way if they mess up any updates it should only effect there own sub-config file.

MaB
09-01-2002, 11:19 PM
that is a good idea!

I was under the impression that any error (even in include files) will not let apache run, is that incorrect?

UH-Matt
09-02-2002, 02:05 AM
It would need testing. I have not really tried anything like that before.

kosmo
09-02-2002, 07:31 AM
Include /private/etc/httpd/users

This is how MacOS X handles virtual hosts definitons. The individual files look like this:
<Directory "/Users/username/Sites/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

MaB
09-04-2002, 06:14 PM
Yes, we know how to do it, thats not the question. It's whether an included file with bad configuration will stop all apache from running - like normal

Michael
09-04-2002, 09:57 PM
It's whether an included file with bad configuration will stop all apache from running - like normal

Yes it will.

Mike

MaB
09-04-2002, 10:11 PM
:(
Thats one good thing about BIND, it wont stop if one config file is bad

Is there any way to compile apache to stop an included file from stopping the whole thing?

Michael
09-05-2002, 12:33 AM
:(
Is there any way to compile apache to stop an included file from stopping the whole thing?

No I do not think so.

Mike

whoppe
09-05-2002, 06:03 PM
Did anyone consider trying the apachectl configtest
command? :)
If its invalid it'll tell you..

MaB
09-05-2002, 06:04 PM
But if one included config file is invalid, then the config test will tell us, it wont help the other resellers make changes. So one corrupt include file for a reseller will stop the server from making changes to others... it wont help :(

mlovick
09-05-2002, 06:20 PM
Have you not used Unix file locking?
This stops the file from being edited whilst its open by another process!

MaB
09-05-2002, 06:27 PM
No, you are missing the point....

Some times reselelrs will hit stop or reaload which will either add an incomplete record to httpd.conf (or an include file) or too many extra lines and it will stop aapche from restarting.

Someone suggested above to do a syntax check before restarting apache, but that still wont help beacuse any changes made by a different reseller (has nothign to do with file locking) wouldnt take effect until apache restarts, and if apache restarts, there will be an error

whoppe
09-05-2002, 06:55 PM
No, configtest wont work as a 100% failsafe solution.
However! it will keep the server from dying on you..if you check that first.

MaB
09-05-2002, 06:59 PM
That is a good idea by the way, to test the config files first, ill probably do that :)

but it still wont solve the major problem of one resellers include from stopping all the others...

is there a way i can test just an include file? THEN i can have it test all includes and if it finds a bad one, just rewreite httpd.conf to not include it :)

whoppe
09-05-2002, 07:20 PM
Uhhm,

I *believe* apachectl configtest will tell you what file is broken.
If one is broken, log it and kill it (with a backup)

karbon14
09-06-2002, 12:19 AM
re: apachectl configtest

i think you can check the result of the command. 0 means successful, > 0 means an error
so if apachectl configtest returns 0, then restart apache.

You could probably write a temporary Include file, test that, if its good then, then overwrite the old one.

How about using .htaccess ? would that help?