Forum Moderators: phranque

Message Too Old, No Replies

Newbie - Authentication question

Best way to configure authorisation

         

phree

11:01 am on Sep 4, 2007 (gmt 0)

10+ Year Member



Hi, I stumbled across this forum whilst trying to make sense of the topic of Authentication in Apache. i was quite suprised to find that most of the questions on the first page are related to .htaccess settings.

I am new to Apache having used it mainly as a test server for a website that i then uploaded to a host. Of recent I have configured a Linux server and added Apache, Mysql and PHP to it and am suing it to educate (hopefully) further on these fine products.

I am developing a site that will have some public pages (anyone can get to them) and some private pages (limited to those I decide I want to access them).

I have played with .htaccess and got that working (at a push) but was reading in the Apache documentation that were possible the configuration file httpd.conf should be used for all configuration, including access and that .htaccess should be limited.

I have a couple of questions that perhaps someone can help me with.

1) Which is the best way to set Authentication, through the .htaccess file or through the 'Directory' directive in the .conf file?

2) If through the 'Directory' does anyone have an example with the various options?

rgds Phree

g1smd

12:35 pm on Sep 4, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It is the same command that you use in either file.

If you have your own dedicated server you will probably have access to httpd.conf. If you use shared or virtual hosting you will not have access to that file.

In any case, you can add the instructions to the relevant .htaccess file.

phree

1:50 pm on Sep 4, 2007 (gmt 0)

10+ Year Member



Thanks for the response.

I kinda guessed that the command would be the same, however I understand that there are a number of switches that could be used in the directory section of the .conf file and I was looking for some examples of what others may have used ( I could be wrong on this as i have read so many inconsistent titbits I have lost track).

I am still non the wiser as to which is the preffered (best practice ) approach. I have access to the .conf file so can do either. Is there a performance hit or doesnt that matter? Which way do people find easiest, to have it all in 1 large configuration file or to split it across a couple?

I want to set it up correctly from the start so am looking for a bit of guidance, a stear as to what causes the least issues.

rgds Phree

g1smd

2:12 pm on Sep 4, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I am told that stuff loaded in httpd.conf works faster as it is compiled in rather than interpreted each time.

However, you need to restart the server to make the changes take effect. I find it easier to add things to .htaccess.