mac下Apache配置(多端口)
一、配置文件
1、Apache的主配置文件是:/etc/apache2/httpd.conf
打开方式:sudo vi /etc/apache2/httpd.conf 1
2、虚拟host配置文件是: /private/etc/apache2/extra/httpd-vhosts.conf
打开方式:sudo vi /etc/apache2/extra/httpd-vhosts.conf 1
3.WebServer位置:Library/WebServer
二、httpd.conf文件编辑
1.Listen 多个端口
2.取消httpd-vhosts.conf–行注释
3.站点设置:”/Users/jun/www”是我的站点,这是替换为自己的站点
DocumentRoot "/Users/jun/www" <Directory /> Options Indexes FollowSymLink AllowOverride All Order allow,deny Allow from all Require all granted </Directory> 1 2 3 4 5 6 7 8 9
三、httpd-vhosts.conf文件操作
1.端口与项目的绑定:‘*:8001’端口号,‘/Users/jun/www/WebAx’项目地址
<VirtualHost *:8001> DocumentRoot "/Users/jun/www/WebAx" <Directory "/Users/jun/www/WebAx"> Options FollowSymLinks AllowOverride All Order allow,deny Allow from all Require all granted </Directory> </VirtualHost> 1 2 3 4 5 6 7 8 9 10
四、Apache操作命令
启动:sudo apachectl start 终止:sudo apachectl stop 重启:sudo apachectl restart 1 2 3
五、文件操作命令
vi的启动和退出 #vi file 编辑file文件 #vi /tmp/file1 编辑指定目录/tem下的file1文件 :w 保存修改 :q 退出vi :wq 保存并退出 :q! 强行退出 vi,不保存修改 1 2 3 4 5 6 7
六、后记
当你按以上的流程走完,基本是没有问题的,但有时也会出现比较奇葩的问题,比如我配置完后,出现了以下文字提示:
Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log.莫慌,只要你删除项目根目录下的.htaccess或者是web.config文件,即可。
相关推荐
Jacry 2020-07-04
Kafka 2020-09-18
Wepe0 2020-10-30
杜倩 2020-10-29
windle 2020-10-29
minerd 2020-10-28
mengzuchao 2020-10-22
Junzizhiai 2020-10-10
bxqybxqy 2020-09-30
风之沙城 2020-09-24
kingszelda 2020-09-22
大唐帝国前营 2020-08-18
yixu0 2020-08-17
TangCuYu 2020-08-15
xiaoboliu00 2020-08-15
songshijiazuaa 2020-08-15
xclxcl 2020-08-03
zmzmmf 2020-08-03
newfarhui 2020-08-03