Apache 如何为来自http://ip/folder?
请帮忙。 我正在尝试设置3个测试站点,以便可以从服务器的ip访问每个站点,如: 我的服务器ip/site1 我的服务器ip/site2 我的服务器ip/site3 当我使用ServerName作为ip时,它可以正常工作:Apache 如何为来自http://ip/folder?,apache,.htaccess,Apache,.htaccess,请帮忙。 我正在尝试设置3个测试站点,以便可以从服务器的ip访问每个站点,如: 我的服务器ip/site1 我的服务器ip/site2 我的服务器ip/site3 当我使用ServerName作为ip时,它可以正常工作: <VirtualHost 127.0.0.1:8080> ServerName x.x.x.x DocumentRoot "/home/myfolder/public_html" <Directory "/home/myfolder/public_html
<VirtualHost 127.0.0.1:8080>
ServerName x.x.x.x
DocumentRoot "/home/myfolder/public_html"
<Directory "/home/myfolder/public_html">
AllowOverride All
</Directory>
</VirtualHost>
进入/usr/local/apache/conf.d/domain-redirects.conf
并将选项添加到/usr/local/apache/conf/httpd.conf中
这确实有效,但并不正确
我知道我可以使用一些域名,并为其他网站设置一些子域。但是使用ip更好
有没有这样的设置方法?您需要将站点存放到服务器访问的目录中。apache提供的默认值是/var/www。因此,如果您的文件位于/var/www/test.html,您可以使用127.0.0.1:8080/test.html访问它。您需要将站点存放到服务器访问的目录中。apache提供的默认值是/var/www。因此,如果您的文件位于/var/www/test.html,您可以使用127.0.0.1:8080/test.html访问它。谢谢!你的想法导致了问题的解决。为了防止有人需要相同的设置,下面是我所做的(在Centos 6+Apache+Varnish上运行)
http://ip
->my apache查看文件夹:
/usr/local/apache/htdocs
我可以在这里创建一个文件夹并上传一个站点,但我已经创建了一个指向我的测试站点的符号链接:
ln -s /home/user/public_html/test_site_folder testsite1
现在,我的测试站点位于http://ip/testsite1
几乎……为了让它对用户有效,我在httpd.conf中添加了这个语句(AllowOverride),以便能够在testsite1根文件夹中的.htaccess中使用mod_rewrite和其他语句
***增加
<Directory "/usr/local/apache/htdocs">
suPHP_UserGroup user user
AllowOverride All ***
Order allow,deny ***
Allow from all ***
suPHP_用户组用户
允许超越所有***
命令允许,拒绝***
通融***
谢谢!你的想法导致了问题的解决。为了防止有人需要相同的设置,下面是我所做的(在Centos 6+Apache+Varnish上运行)
http://ip
->my apache查看文件夹:
/usr/local/apache/htdocs
我可以在这里创建一个文件夹并上传一个站点,但我已经创建了一个指向我的测试站点的符号链接:
ln -s /home/user/public_html/test_site_folder testsite1
现在,我的测试站点位于http://ip/testsite1
几乎……为了让它对用户有效,我在httpd.conf中添加了这个语句(AllowOverride),以便能够在testsite1根文件夹中的.htaccess中使用mod_rewrite和其他语句
***增加
<Directory "/usr/local/apache/htdocs">
suPHP_UserGroup user user
AllowOverride All ***
Order allow,deny ***
Allow from all ***
suPHP_用户组用户
允许超越所有***
命令允许,拒绝***
通融***