2017-11-01 22 views
0

OSXでApacheをセットアップしようとしていますが、ローカルURL「awr.local」を正しいパスにすることができません。私はhttp://localhostと入力するかと入力するかは、「localhost」仮想パスにindex.htmlページが表示されます。 私はsudoの有無にかかわらず、無数の時間、私のhttpdサービスを再起動しました。Apache virtualHostが無視されるか、デフォルトの1つを指しています

ご協力いただければ幸いです。私はここに、チュートリアル(https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions)は、次のしてきた

は、Apacheについての手順は、次のとおりです。

は、バンドルされてApacheを無効にし、自作のものをインストールする:

sudo apachectl stop 
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null 
brew install httpd 

その後、いくつかのhttpd.conf変更点:

# changed Listen 8080 to : 
Listen 80 
[...] 
# changed DocumentRoot "/usr/local/var/www" to : 
DocumentRoot "/Users/wallace/dev/default" 
[...] 
# changed <Directory "/usr/local/var/www"> to : 
<Directory "/Users/wallace/dev/default"> 
[...] 
# changed AllowOverride None to : 
AllowOverride All 
# uncommented : 
LoadModule rewrite_module lib/httpd/modules/mod_rewrite.so 
[...] 
# changed 
# User _www 
# Group _www 
# to : 
User wallace 
Group staff 
[...] 
# added the missing line : 
ServerName localhost 

この時点までは問題なく動作していたようでしたが、PHPとMariaDBを問題なくインストールしました。その後

は、仮想ホストの一部を来た:

他のいくつかのhttpd.confの変更:

# uncommenting these lines 
LoadModule vhost_alias_module lib/httpd/modules/mod_vhost_alias.so 
[...] 
Include /usr/local/etc/httpd/extra/httpd-vhosts.conf 

がファイル/usr/local/etc/httpd/extra/httpd-vhosts.confの編集:

<VirtualHost *:80> 
    DocumentRoot "/Users/wallace/dev/default" 
    ServerName localhost 
</VirtualHost> 

<VirtualHost *:80> 
    DocumentRoot "/Users/wallace/dev/awr" 
    ServerName awr.local 
</VirtualHost> 

/etc/hostsファイル:

127.0.0.1  localhost 
255.255.255.255 broadcasthost 
::1    localhost 
127.0.0.1  awr.local 
::1    awr.local 

「のhttpd -S」の出力は:

VirtualHost configuration: 
*:80     is a NameVirtualHost 
     default server localhost (/usr/local/etc/httpd/extra/httpd-vhosts.conf:25) 
     port 80 namevhost localhost (/usr/local/etc/httpd/extra/httpd-vhosts.conf:25) 
     port 80 namevhost awr.local (/usr/local/etc/httpd/extra/httpd-vhosts.conf:30) 
ServerRoot: "/usr/local/opt/httpd" 
Main DocumentRoot: "/Users/wallace/dev/default" 
Main ErrorLog: "/usr/local/var/log/httpd/error_log" 
Mutex rewrite-map: using_defaults 
Mutex default: dir="/usr/local/var/run/httpd/" mechanism=default 
Mutex mpm-accept: using_defaults 
PidFile: "/usr/local/var/run/httpd/httpd.pid" 
Define: DUMP_VHOSTS 
Define: DUMP_RUN_CFG 
User: name="wallace" id=501 not_used 
Group: name="staff" id=20 not_used 

答えて

0

さて、今日は、私は新しい何かを持っていた:代わりに、私はローカルホストにサービスを提供するの、awr.local URLは私に禁じ403を示しました。新しい研究&ドキュメントの読み込み後、私はそれがこのように動作させるために管理:

マイ/usr/local/etc/httpd/extra/httpd-vhosts.confファイル:

はすべてを付与された要求を最も重要な部分です。

<VirtualHost *:80> 
    DocumentRoot "/Users/wallace/dev/default" 
    ServerName localhost 
    <Directory "/Users/wallace/dev/default"> 
     Options Indexes FollowSymLinks 
     AllowOverride All 
     Require all granted 
    </Directory> 
</VirtualHost> 

<VirtualHost *:80> 
    DocumentRoot "/Users/wallace/dev/awr" 
    ServerName awr.local 
    <Directory "/Users/wallace/dev/awr"> 
     Options Indexes FollowSymLinks 
     AllowOverride All 
     Require all granted 
    </Directory> 
</VirtualHost> 

は、私はそれを動作させるためのsudoのではApacheを再起動する必要がありました:

sudoのBREWサービス停止のhttpd & & sudoの醸造サービスはhttpdの

を開始します
0

これは私が(私はあなたの設定に一致するように変更を加えました)、それはセットアップを持っているかです。
さらに、awr.localは、127.0.0.1を指している/ etc/hostsファイルまたは使用したい他のネットワークインターフェイスになければなりません。私はファンの答えをしようと準備していた

<VirtualHost awr.local:80> 
    DocumentRoot "/Users/wallace/dev/awr" 
    ServerName awr.local 
    <Directory "/Users/wallace/dev/awr"> 
      AllowOverride All 
      Order allow,deny 
      allow from all 
      Require all granted 
    </Directory>  
</VirtualHost> 
関連する問題