我想做的是开发一个从任何地方与互联网连接的网站。显而易见的答案是注册一个网络主机,然后选择一个域名(例如project1.shoreline-development.com,或者其他任何域名)。然而,理想情况下,我不希望其他任何人能够看到这个网站的内容,因为我需要查看错误消息等等,所以它需要一个身份验证层来让我查看我的网站,并且在其中它可能需要它自己的特定于网站软件的身份验证方法。
这样的事情真的存在吗?
谢谢。
编辑: 09/11/2013 11:22
例如,当我坐在火车上时,我希望能够从我的手机上进行开发,或者当我去探望父母时,我的老掉牙的笔记本电脑,或者我从别人那里借来的电脑,或者网吧,或者我的工作电脑。
对于造成的误解,我深表歉意,感谢您目前为止的帮助。
发布于 2013-01-09 18:38:40
这就是您想要的(假设您正在浏览http://localhost/test-dir1/,并且您希望其他人看不到此页面)
.htaccess File Creation:
$ cd /var/www/html/test-dir1
$ vi .htaccess将以下行写入此文件:
AuthName "Authorized Users Only."
AuthType Basic
AuthUserFile /etc/httpd/conf/.htpasswd
require user testusr您还可以在VirtualHost中
发布于 2013-01-09 18:32:22
.htaccess提供了一种简单的方法来实现这一点。
发布于 2013-01-09 18:39:24
我在apache2中使用http身份验证和授权,以限制每个IP或每个用户/密码的访问:
如果设置了虚拟主机,则解决方案将如下所示:
<VirtualHost *:80>
DocumentRoot "/path/to/document/root"
ServerName subdomain.domain.tld
<Directory "/path/to/document/root">
#Uncomment the following if you want restrict access per IP
#Order Deny,Allow
#Deny from all
#Allow from A.B.C.D
AuthName "Authorized Personel Only"
AuthType Basic
AuthUserFile "/Path/to/your/httpasswd/file"
require valid-user
allow from all
Options +Indexes
</Directory>
ErrorLog /var/log/apache2/domain.error.log
CustomLog /var/log/apache2/domain.access.log combined
</VirtualHost>https://stackoverflow.com/questions/14233155
复制相似问题