Apache设置自动运行index.php文件
2014-07-23 10:05
721 查看
我这公司本地服务器目录有两个网站程序.有一个是由我参与开发的.但是访问的地址是192.168.2.120/clzv2.
只能打这个地址,要打192.168.2.120 就显示 It Works!
我就配置了虚拟主机.但是还是不能识别自动index.php主入口文件.非要我自己打上去,妈蛋,这不是我想要的,
我在阿里云上面配置虚拟主机为什么都不是这样的.一时,我也没有想到解决方法.就暂时那样用了.
这几天,我因为需要,又把虚拟主机关了,这时,我想,之前这个网站是怎么配置的.
打开httpd.conf 看到
这个目录地址最后有个
这时,我就想,是不是在我配置虚拟主机的.也要加上这句话,
然后我要网上搜了一下这个相关信息
说实话,我知道是可以这样配置的,但是我忘了在哪.
于是,我就在猜想本地apache配置文件,应该没有添加index.php
于是找到了上面这段配置,就是能识别的索引文件
它只有index.html
我在阿里云上也看了下httpd.conf的配置
大家请看,阿里云的支持这些.我本地的服务器才一个,
只要添加上就可以了,记得重启Apache
只能打这个地址,要打192.168.2.120 就显示 It Works!
我就配置了虚拟主机.但是还是不能识别自动index.php主入口文件.非要我自己打上去,妈蛋,这不是我想要的,
我在阿里云上面配置虚拟主机为什么都不是这样的.一时,我也没有想到解决方法.就暂时那样用了.
这几天,我因为需要,又把虚拟主机关了,这时,我想,之前这个网站是怎么配置的.
打开httpd.conf 看到
<Directory /> AllowOverride none Require all denied </Directory> <Directory "/usr/local/apache2/htdocs/tycart"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all DirectoryIndex index.php </Directory> <Directory "/usr/local/apache2/htdocs/oa"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all DirectoryIndex index.php </Directory>
这个目录地址最后有个
DirectoryIndex index.php
这时,我就想,是不是在我配置虚拟主机的.也要加上这句话,
然后我要网上搜了一下这个相关信息
问:如何让Apache能自动运行index.php? 答:编辑httpd.conf文件,找到DirectoryIndex在后面加一个index.php。 例如,我把DirectoryIndex这行改为:DirectoryIndex index.html index.htm index.php index.html.var 保存编辑的内容,重新启动Apache就可以实现了。 <Directory /xxx> DirectoryIndex index.html index.htm index.php index.php3 </Directory>
说实话,我知道是可以这样配置的,但是我忘了在哪.
于是,我就在猜想本地apache配置文件,应该没有添加index.php
# # DirectoryIndex: sets the file that Apache will serve if a directory # is requested. # <IfModule dir_module> DirectoryIndex index.html </IfModule>
于是找到了上面这段配置,就是能识别的索引文件
它只有index.html
我在阿里云上也看了下httpd.conf的配置
</Directory> # # DirectoryIndex: sets the file that Apache will serve if a directory # is requested. # <IfModule dir_module> DirectoryIndex index.html index.htm index.php </IfModule>
大家请看,阿里云的支持这些.我本地的服务器才一个,
只要添加上就可以了,记得重启Apache
相关文章推荐
- 如何让Apache能自动运行index.php?
- apache禁止访问文件或目录执行权限、禁止运行脚本PHP文件的设置方法
- apache环境下禁止某文件夹内运行PHP脚本、禁止访问文件或目录执行权限的设置方法
- 如何让Apache能自动运行index.php?
- apache禁止访问文件或目录执行权限、禁止运行脚本PHP文件的设置方法
- Apache:设置首页运行index.html index.php的顺序
- apache环境下禁止某文件夹内运行PHP脚本、禁止访问文件或目录执行权限的设置方法
- apache环境下禁止某文件夹内运行PHP脚本、禁止访问文件或目录执行权限的设置方法
- apache禁止访问文件或目录执行权限、禁止运行脚本PHP文件的设置方法
- 对apache的php项目文件夹下浏览器默认打开什么文件的设置(如index.php)
- 访问项目时,不能自动加载index.php文件
- 设置eclipse在编译运行项目之前自动保存修改的文件
- apache rewrite设置 禁止某个文件夹执行php文件
- 在apache中设置访问目录后进入的默认页面为index.php
- (PHP)设置修改 Apache 文件根目录 (Document Root)(转帖)
- Linux系统下Apache日志文件设置、更改默认网站目录、防止php木马跨站设置、禁止空主机头
- 修改apache配置文件去除thinkphp url中的index.php
- 在apache中设置访问目录后进入的默认页面为index.php
- 修改apache配置文件去除thinkphp url中的index.php
- 访问项目时,不能自动加载index.php文件