开发者

configure httpd.conf to allow host access to my website

I have a server which is online right now, but requires authentication when accessing, so it is basically closed to everyone but me.

Thing is, I don't want to "Open" the website to the public, but I need to test my website on different browsers.

One way is to do it from websites like browsershots.org, which requires access to my website. But my website is "closed" (requires authentication) from anyone except me.

I have these lines in my apache2.conf (or httpd.conf as it also is known as):

 <Directory /var/www>
 AuthType Basic
 AuthName "Some  name"
 AuthUserFile "dir/to/some/file"
 Require user some_user
 </D开发者_运维技巧irectory>

These above allows only access to somebody with username "some_user" and a passwords which is located in "dir/to/some/file".

Now, is there any way to give access to the website from a host also?

My problem is like I said, when trying to cross-browser check my website from sites which requires an URL to my website, they are all blocked because of the authentication I have. Do I have to turn off the authentication in order to be able to cross-browser check?

Thanks


If you could verify what IP address they would be hitting your website from, you could use a combination of the Allow and Deny directives to make sure that only requests originating from browsershots.org's IP address get through.

http://httpd.apache.org/docs/2.0/mod/mod_access.html

You can create a page that shows the visitors IP, visit your site from browsershots.org, then use that in your apache config.


What about if you removed the authentication, but then added PHP code to restrict access by IP, so that the site was only accessible from your own computer? Would that work for your purposes? Something like this:

http://www.wmtips.com/php/simple-ways-restrict-access-webpages-using.htm#ip

Edit: sjobe has the better plan. Same idea, but that way you can still let BrowserShots do the work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜