简体   繁体   English

Apache新的DocumentRoot

[英]Apache new DocumentRoot

I used to have my apache server loading it's files from: 我曾经让我的apache服务器从以下位置加载文件:

Library/Webserver/CGI-Executables/Location1

My new website is at a different location: 我的新网站位于其他位置:

Library/Webserver/CGI-Executables/Location2

I changed all the paths in httpd.conf that linked to location1 to location2. 我将链接到location1的httpd.conf中的所有路径更改为location2。 Then i restarted the apache server. 然后,我重新启动了Apache服务器。 So first i killed the current running server: 所以首先我杀死了当前正在运行的服务器:

sudo apachectl stop

Then checked my logs using: 然后使用以下命令检查我的日志:

ps -ef | grep "httpd"

This showed me that i successfully stopped the process. 这表明我成功停止了该过程。 My next step was to start it again: 我的下一步是重新开始:

sudo apachectl start

Checked the logs again and it had the new processes on there. 再次检查日志,并且那里有新的进程。 When i go onto localhost/index.html (which is the index file for location 2), it doesn't work. 当我进入localhost / index.html(这是位置2的索引文件)时,它不起作用。 However if I enter in localhost/index.php (index file for location 1), the webpage works, which means that the apache server is still running from location 1. 但是,如果我输入localhost / index.php(位置1的索引文件),则该网页可以工作,这意味着apache服务器仍从位置1运行。

When i check httpd.conf again, the location is still set to location 2, so this is where i'm getting a little overwhelmed. 当我再次检查httpd.conf时,该位置仍设置为位置2,因此这让我有点不知所措。 Logically, it looks like this should work, but for some reason it is still directing to the old path rather than the new path. 从逻辑上讲,这似乎应该可以工作,但是由于某些原因,它仍然指向旧路径而不是新路径。

Is there some vital step i missed? 我错过了一些重要的步骤吗?

Check for 'Alias'.... May be you have the location1 path directing to some Alias path which is getting picked as you are checking for the location1 path but not Alias. 检查'Alias'....可能是因为您有指向某些Alias路径的location1路径,当您正在检查location1路径而不是Alias时,该路径已被选择。 Mostly in httpd.conf cgi script path has Alias by default.... But then this is an guess solution as normally the steps you have followed are correct and should have worked. 默认情况下,大多数在httpd.conf中,cgi脚本路径默认都具有Alias...。但是,这是一种猜测解决方案,因为通常情况下,您遵循的步骤是正确的并且应该可以执行。 Check 'ScriptAlias' directive also for your location1 path pointing to any Alias..... 还要检查“ ScriptAlias”指令是否找到指向任何别名的location1路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM