当前位置:Gxlcms > PHP教程 > php服务器怎么配置

php服务器怎么配置

时间:2021-07-01 10:21:17 帮助过:33人阅读

配置php服务器的方法:1、设置根目录、域名和目录权限;2、更改默认首页;3、更改监听端口,如80端口;4、配置虚拟主机,指定虚拟目录路径。

服务器配置

(视频教程推荐:java视频教程)

1、虚拟目录配置

  1. <VirtualHost _default_:80>
  2. #设置根目录
  3. DocumentRoot "G:\\phpStudy\\PHPTutorial\\phpMyAdmin"
  4. #设置域名
  5. ServerName www.phpmyadmin.com
  6. #目录权限
  7. <Directory "G:\\phpStudy\\PHPTutorial\\phpMyAdmin">
  8. #允许将目录结构用索引的方式展示
  9. Options +Indexes +FollowSymLinks +ExecCGI
  10. #允许覆盖;,用来做分布式部署
  11. AllowOverride All
  12. #执行顺序,先允许,后拒绝
  13. Order allow,deny
  14. #允许所有请求
  15. Allow from all
  16. Require all granted
  17. </Directory>
  18. </VirtualHost>

更改默认首页

  1. <IfModule dir_module>
  2. DirectoryIndex index.html index.php index.htm l.php
  3. </IfModule>

更改监听端口

  1. Listen 80

2、虚拟主机配置

  1. <VirtualHost _default_:80>
  2. DocumentRoot "C:\\web1" #指定虚拟目录路径
  3. ServerName www.baidu.com # 虚拟目录绑定的域名
  4. DirectoryIndex aa.php # 默认首页
  5. <Directory "C:\\web1">
  6. Options -Indexes -FollowSymLinks +ExecCGI
  7. AllowOverride All
  8. Order allow,deny
  9. Allow from all
  10. Require all granted
  11. </Directory>
  12. </VirtualHost>

相关推荐:php培训

以上就是php服务器怎么配置的详细内容,更多请关注gxlcms其它相关文章!

人气教程排行