调用Mac Yosemite上的Apache
在Mac的Apache环境下,在午餐前享用早餐。
我已经很累了,所以打算使用Mac自带的Apache,不需要重新安装了。
Yosemite 使用的是2.4版本。
我记得Mavericks使用的是2.2版本吧?
大致上以配置文件为主。
我认为因为这里很详细,所以在这里应该就可以了
在OS X Yosemite上使用Homebrew + Dropbox构建PHP环境 〜 安装Apache、PHP、MySQL、Composer和配置FuelPHP – Qiita
http://qiita.com/saltyshiomix/items/aacb5f9635c0d3201174
版本确认(当前正在运行的那个)
MacMini:~ root# apachectl -V
Server version: Apache/2.4.9 (Unix)
Server built: Sep 9 2014 14:48:20
Server's Module Magic Number: 20120211:31
Server loaded: APR 1.4.8, APR-UTIL 1.5.2
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture: 64-bit
Server MPM: prefork
threaded: no
forked: yes (variable process count)
Server compiled with....
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_FLOCK_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT="/usr"
-D SUEXEC_BIN="/usr/bin/suexec"
-D DEFAULT_PIDLOG="/private/var/run/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="/private/etc/apache2/mime.types"
-D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf"
MacMini:~ root#
私人/etC /apache2:
对不起,这个看起来不太清楚。
新的文字是指向这边的箭头。
原本的描述中有指向这边的箭头。
115,117c115,117
< LoadModule log_debug_module libexec/apache2/mod_log_debug.so
< LoadModule log_forensic_module libexec/apache2/mod_log_forensic.so
< LoadModule logio_module libexec/apache2/mod_logio.so
---
> #LoadModule log_debug_module libexec/apache2/mod_log_debug.so
> #LoadModule log_forensic_module libexec/apache2/mod_log_forensic.so
> #LoadModule logio_module libexec/apache2/mod_logio.so
143c143
< LoadModule ssl_module libexec/apache2/mod_ssl.so
---
> #LoadModule ssl_module libexec/apache2/mod_ssl.so
160,161c160,161
< LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so
< #LoadModule negotiation_module libexec/apache2/mod_negotiation.so
---
> #LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so
> LoadModule negotiation_module libexec/apache2/mod_negotiation.so
169c169
< LoadModule php5_module libexec/apache2/libphp5.so
---
> #LoadModule php5_module libexec/apache2/libphp5.so
213d212
< ServerName localhost
237,271c236,251
< # DocumentRoot "/Library/WebServer/Documents"
< # <Directory "/Library/WebServer/Documents">
< # #
< # # Possible values for the Options directive are "None", "All",
< # # or any combination of:
< # # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
< # #
< # # Note that "MultiViews" must be named *explicitly* --- "Options All"
< # # doesn't give it to you.
< # #
< # # The Options directive is both complicated and important. Please see
< # # http://httpd.apache.org/docs/2.4/mod/core.html#options
< # # for more information.
< # #
< # Options FollowSymLinks Multiviews
< # MultiviewsMatch Any
< #
< # #
< # # AllowOverride controls what directives may be placed in .htaccess files.
< # # It can be "All", "None", or any combination of the keywords:
< # # AllowOverride FileInfo AuthConfig Limit
< # #
< # AllowOverride None
< #
< # #
< # # Controls who can get stuff from this server.
< # #
< # Require all granted
< # </Directory>
< DocumentRoot "/var/www"
< <Directory />
< Options ExecCGI FollowSymLinks Indexes Includes MultiViews
< AllowOverride All
< Require all denied
< </Directory>
---
> DocumentRoot "/Library/WebServer/Documents"
> <Directory "/Library/WebServer/Documents">
> #
> # Possible values for the Options directive are "None", "All",
> # or any combination of:
> # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
> #
> # Note that "MultiViews" must be named *explicitly* --- "Options All"
> # doesn't give it to you.
> #
> # The Options directive is both complicated and important. Please see
> # http://httpd.apache.org/docs/2.4/mod/core.html#options
> # for more information.
> #
> Options FollowSymLinks Multiviews
> MultiviewsMatch Any
273,274c253,257
< <Directory "/var/www">
< Options ExecCGI FollowSymLinks Indexes Includes MultiViews
---
> #
> # AllowOverride controls what directives may be placed in .htaccess files.
> # It can be "All", "None", or any combination of the keywords:
> # AllowOverride FileInfo AuthConfig Limit
> #
275a259,262
>
> #
> # Controls who can get stuff from this server.
> #
284c271
< DirectoryIndex index.html index.php
---
> DirectoryIndex index.html
432,433c419
< AddHandler cgi-script .cgi
< AddHandler php5-script .php
---
> #AddHandler cgi-script .cgi
444,445c430,431
< AddType text/html .shtml
< AddOutputFilter INCLUDES .shtml
---
> #AddType text/html .shtml
> #AddOutputFilter INCLUDES .shtml
513c499
< Include /private/etc/apache2/extra/httpd-vhosts.conf
---
> #Include /private/etc/apache2/extra/httpd-vhosts.conf
555,558d540
< Redirect 404 /favicon.ico
< <Location /favicon.ico>
< ErrorDocument 404 "No favicon"
< </Location>
私有/等等/Apache2/额外:
虚拟主机的设置被完全删除并重新编写。
原始文件夹中保留了变更之前的文件。
原本想使用test.jquery.dev,但无法实现(可能有错误)。
由于成功连接了jquery.dev,所以没有继续追踪其他问题。
Listen 80
<VirtualHost *:80>
DocumentRoot "/var/www/jquery"
ServerName jquery.dev
ServerAlias *.jquery.dev
Loglevel warn
SSLEngine off
ErrorLog "/var/www/logs/jquery/error_log"
CustomLog "/var/www/logs/jquery/access_log" common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/var/www/wordpress"
ServerName wordpress.dev
ServerAlias *.wordpress.dev
Loglevel warn
ErrorLog "/var/www/logs/wordpress/Error_log"
CustomLog "/var/www/logs/wordpress/access_log" common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/var/www/phpmyadmin"
ServerName phpmyadmin.dev
ServerAlias *.phpmyadmin.dev
Loglevel warn
ErrorLog "/var/www/logs/phpmyadmin/error_log"
CustomLog "/var/www/logs/phpmyadmin/access_log" common
Options none
<Directory "/var/www/phpmyadmin">
Options none
AllowOverride Limit
Require all denied
Require ip 127.0.0.1 172.16.0.0/255.240.0.0 192.168
</Directory>
</VirtualHost>
/私人/等等
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 MacMini.local localhost.localdomain localhost
127.0.0.1 jquery.dev
127.0.0.1 phpmyadmin.dev
127.0.0.1 wp.dev
255.255.255.255 broadcasthost
/var/www目录
我会创建一个目录
也会创建一个日志目录
由于是测试用途,所以全部都是777权限
我会用root账户进行操作,但我会在第一行写上“变成root”的咒语(笑)
所需的密码是在启动时输入您自己的密码
MacMini:tmp kanekoeiji$ sudo su -
Password:
Sorry, try again.
Password:
Sorry, try again.
Password:
MacMini:~ root# mkdir -p /var/www/jquery/
MacMini:~ root# mkdir -p /var/www/phpmyadmin
MacMini:~ root# mkdir -p /var/www/wordpress
MacMini:~ root# mkdir -p /var/www/logs/jquery/
MacMini:~ root# mkdir -p /var/www/logs/phpmyadmin
MacMini:~ root# mkdir -p /var/www/logs/wordpress
MacMini:~ root# chmod -R 777 /var/www
我会随意创建一个虚拟文件。
MacMini:~ root# echo aaa > /var/www/aaa.html
MacMini:~ root# echo '<?php phpinfo();' > /var/www/jquery/phpinfo.php
MacMini:~ root# chmod -R 777 /var/www
开始吧
MacMini:~ root# apachectl stop
MacMini:~ root# apachectl start
这应该是连接的方式
通过http://localhost/?
或者通过http://jquery.dev/?