mac下Apache配置(多端口),macapache配置端口


一、配置文件
1、Apache的主配置文件是:/etc/apache2/httpd.conf

打开方式:sudo vi /etc/apache2/httpd.conf

2、虚拟host配置文件是: /private/etc/apache2/extra/httpd-vhosts.conf

打开方式:sudo vi /etc/apache2/extra/httpd-vhosts.conf

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>

三、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>

四、Apache操作命令

启动:sudo apachectl start
终止:sudo apachectl stop
重启:sudo apachectl restart

五、文件操作命令

vi的启动和退出
#vi file 编辑file文件
#vi /tmp/file1 编辑指定目录/tem下的file1文件
:w 保存修改
:q 退出vi
:wq 保存并退出
:q! 强行退出 vi,不保存修改

六、后记
当你按以上的流程走完,基本是没有问题的,但有时也会出现比较奇葩的问题,比如我配置完后,出现了以下文字提示:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at you@example.com 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文件,即可。
文章链接:http://www.daixiaorui.com/read/123.html

相关内容

    暂无相关文章