I cant change my web root in apache, for some reason it points to /Sites/folder1/folder2 instead of it pointing to /Sites. I configured and change my apache <Directory "/Users/saad/Sites">
and DocumentRoot /Users/saad/Sites
restarted my apachectl and still nothing.
我不能在apache中改变我的web根,因为某些原因它指向/站点/folder1/folder2,而不是指向/站点。我配置并更改了我的apache <目录“ 用户 saad 站点”> 和DocumentRoot /Users/saad/站点重新启动了我的apachectl,仍然什么都没有。
6 个解决方案
#1
24
I just meet this problem, too. I need to change the DocumentRoot and point it to my customised directory, which used for saving image files.
我也遇到了这个问题。我需要更改DocumentRoot并将它指向我的定制目录,该目录用于保存图像文件。
Berkay is right, you need edit a bit on your apache httpd.config file, but besides that, you need to do one more change, otherwise the WebSharing won't be able to turn on again.
Berkay是对的,你需要在apache httpd上编辑一点。配置文件,但是除此之外,你还需要做一个改变,否则网络共享就不能再打开了。
-
Open your httpd.config by your favorite editor (Probably need to do this if you haven't change the permission access to this file)
打开httpd。由您最喜爱的编辑器配置(如果您没有更改此文件的权限访问,可能需要这样做)
- sudo chmod 666 httpd.conf
- sudo chmod 666 httpd . conf
- Open httpd.config, and start editing.
- 打开httpd。配置,开始编辑。
- sudo chmod 644 httpd.conf, when it's finished, proceed to step 2 (change it back to original permisson access)
- sudo chmod 644 httpd。conf完成后,继续第2步(将其更改为原来的permisson访问)
-
Find
DocumentRoot "/Library/WebServer/Documents"
, and change it toDocumentRoot "/Users/leiwang/Sites"
or any other folders you want to.找到DocumentRoot“/Library/WebServer/Documents”,并将其更改为DocumentRoot“/Users/leiwang/Sites”或其他任何您想要的文件夹。
-
One important thing is, you need to give the Read/Write permission to the folder you specified.
重要的是,您需要将读/写权限授予您指定的文件夹。
- sudo chmod -R 747 foldername
- sudo chmod - r747 foldername。
Hope it helps:)
希望它能帮助:)
#2
6
there is a documentroot property in the /etc/apache2/httpd.conf on osx. so we can easily change the path like this;
在/etc/apache2/httpd中有一个documentroot属性。conf osx上。我们可以很容易地改变路径;
DocumentRoot "{YOUR_ROOT_PATH}"
DocumentRoot“{ YOUR_ROOT_PATH }”
#3
4
I ran into this problem: Once you change the root of web server to somewhere other than the default (/Library/WebServer/Documents), you need setup virtual host, otherwise, localhost will not work, and you will get:403 Forbidden
error
You can refer to this link for details on how to set it up:
http://coolestguidesontheplanet.com/set-virtual-hosts-apache-mac-osx-10-10-yosemite/
我遇到了这个问题:一旦你改变web服务器的根在其他地方,而不是默认的(/图书馆/网络服务器/文档),你需要设置虚拟主机,否则,主机不工作,和你会得到:403禁止错误详情您可以参考这个链接如何设置它:http://coolestguidesontheplanet.com/set-virtual-hosts-apache-mac-osx-10-10-yosemite/
Also make sure the following line is in the configuration file for the web directory if your Max is running OS X 10.10:Require all granted
如果您的Max正在运行OS X 10.10,请确保下面的行位于web目录的配置文件中:要求所有的都是允许的。
For your reference, I just remind you if this ever happens to you.
作为你的参考,我只是提醒你这是否发生在你身上。
#4
2
I went to /etc/apache/users/saad.conf and added the virtual host in this form "www.x.dev" to the top of my virtual hosts list. this temporarily fixed the problem. hope this helps
我去/etc/apache/users/saad.conf在这个表单中添加了虚拟主机“www.x.dev”到我的虚拟主机列表的顶部。这暂时解决了问题。希望这有助于
#5
2
I came across the similar question as you, the httpd.conf under /private/etc/apache2/
defines the DocumentRoot as /Library/Webserver/Documents
. But that directory doesn't work!
我遇到了类似的问题,httpd。conf /private/etc/apache2/定义了DocumentRoot as /Library/Webserver/文档。但是那个目录不行!
Instead,the DocumentRoot which actually works is /usr/htdocs
! Weird!
相反,实际工作的DocumentRoot是/usr/htdocs!奇怪!
#6
1
In case this helps someone else, it looks like Sierra made a backup file for me at:
如果这能帮助别人,Sierra为我做了一个备份文件:
/etc/apache2/httpd.conf~previous
/etc/apache2/httpd.conf ~之前
I was able to copy my old configuration file into the new one, restarted apache and it worked.
我能够将我的旧配置文件复制到新的配置文件中,重新启动apache,并成功运行。
#1
24
I just meet this problem, too. I need to change the DocumentRoot and point it to my customised directory, which used for saving image files.
我也遇到了这个问题。我需要更改DocumentRoot并将它指向我的定制目录,该目录用于保存图像文件。
Berkay is right, you need edit a bit on your apache httpd.config file, but besides that, you need to do one more change, otherwise the WebSharing won't be able to turn on again.
Berkay是对的,你需要在apache httpd上编辑一点。配置文件,但是除此之外,你还需要做一个改变,否则网络共享就不能再打开了。
-
Open your httpd.config by your favorite editor (Probably need to do this if you haven't change the permission access to this file)
打开httpd。由您最喜爱的编辑器配置(如果您没有更改此文件的权限访问,可能需要这样做)
- sudo chmod 666 httpd.conf
- sudo chmod 666 httpd . conf
- Open httpd.config, and start editing.
- 打开httpd。配置,开始编辑。
- sudo chmod 644 httpd.conf, when it's finished, proceed to step 2 (change it back to original permisson access)
- sudo chmod 644 httpd。conf完成后,继续第2步(将其更改为原来的permisson访问)
-
Find
DocumentRoot "/Library/WebServer/Documents"
, and change it toDocumentRoot "/Users/leiwang/Sites"
or any other folders you want to.找到DocumentRoot“/Library/WebServer/Documents”,并将其更改为DocumentRoot“/Users/leiwang/Sites”或其他任何您想要的文件夹。
-
One important thing is, you need to give the Read/Write permission to the folder you specified.
重要的是,您需要将读/写权限授予您指定的文件夹。
- sudo chmod -R 747 foldername
- sudo chmod - r747 foldername。
Hope it helps:)
希望它能帮助:)
#2
6
there is a documentroot property in the /etc/apache2/httpd.conf on osx. so we can easily change the path like this;
在/etc/apache2/httpd中有一个documentroot属性。conf osx上。我们可以很容易地改变路径;
DocumentRoot "{YOUR_ROOT_PATH}"
DocumentRoot“{ YOUR_ROOT_PATH }”
#3
4
I ran into this problem: Once you change the root of web server to somewhere other than the default (/Library/WebServer/Documents), you need setup virtual host, otherwise, localhost will not work, and you will get:403 Forbidden
error
You can refer to this link for details on how to set it up:
http://coolestguidesontheplanet.com/set-virtual-hosts-apache-mac-osx-10-10-yosemite/
我遇到了这个问题:一旦你改变web服务器的根在其他地方,而不是默认的(/图书馆/网络服务器/文档),你需要设置虚拟主机,否则,主机不工作,和你会得到:403禁止错误详情您可以参考这个链接如何设置它:http://coolestguidesontheplanet.com/set-virtual-hosts-apache-mac-osx-10-10-yosemite/
Also make sure the following line is in the configuration file for the web directory if your Max is running OS X 10.10:Require all granted
如果您的Max正在运行OS X 10.10,请确保下面的行位于web目录的配置文件中:要求所有的都是允许的。
For your reference, I just remind you if this ever happens to you.
作为你的参考,我只是提醒你这是否发生在你身上。
#4
2
I went to /etc/apache/users/saad.conf and added the virtual host in this form "www.x.dev" to the top of my virtual hosts list. this temporarily fixed the problem. hope this helps
我去/etc/apache/users/saad.conf在这个表单中添加了虚拟主机“www.x.dev”到我的虚拟主机列表的顶部。这暂时解决了问题。希望这有助于
#5
2
I came across the similar question as you, the httpd.conf under /private/etc/apache2/
defines the DocumentRoot as /Library/Webserver/Documents
. But that directory doesn't work!
我遇到了类似的问题,httpd。conf /private/etc/apache2/定义了DocumentRoot as /Library/Webserver/文档。但是那个目录不行!
Instead,the DocumentRoot which actually works is /usr/htdocs
! Weird!
相反,实际工作的DocumentRoot是/usr/htdocs!奇怪!
#6
1
In case this helps someone else, it looks like Sierra made a backup file for me at:
如果这能帮助别人,Sierra为我做了一个备份文件:
/etc/apache2/httpd.conf~previous
/etc/apache2/httpd.conf ~之前
I was able to copy my old configuration file into the new one, restarted apache and it worked.
我能够将我的旧配置文件复制到新的配置文件中,重新启动apache,并成功运行。