# --- Require访问控制管理 # Require all granted允许所有访问 # Require all denied拒绝所有访问 # Require ip 192.168.1.0/24 仅允许192.168.1.0/24网络的主机访问 # Require not ip 192.168.1.2 禁止192.168.1.2的主机访问,其它都可以 DocumentRoot "/Library/WebServer/Documents" <Directory"/Library/WebServer/Documents"> Options FollowSymLinks Multiviews MultiviewsMatch Any Require all granted </Directory>
# # The following lines prevent .htaccess and .htpasswd files from being # viewed by Web clients. # 防止 .htaccess 和 .htpasswd 文件被从Web上访问 <FilesMatch "^\.([Hh][Tt]|[Dd][Ss]_[Ss])"> Require all denied </FilesMatch>
# Apple specific filesystem protection. # 苹果特定文件系统保护,全是拒绝访问,所以可以不用管 <Files "rsrc"> Require all denied </Files> <DirectoryMatch ".*\.\.namedfork"> Require all denied </DirectoryMatch>
<IfModule log_config_module> # 日志格式 # The following directives define some format nicknames for use with # a CustomLog directive (see below). # LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module> # You need to enable mod_logio.c to use %I and %O LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio </IfModule>
# 访问 apache 访问日志 CustomLog "/private/var/log/apache2/access_log" common
# # If you prefer a logfile with access, agent, and referer information # (Combined Logfile Format) you can use the following directive. # #CustomLog "/private/var/log/apache2/access_log" combined </IfModule>
# 读取其他的配置 Include /private/etc/apache2/other/*.conf
brew info mysql #下面一大段信息都是所安装的数据库的信息,以及如何开启数据库服务 mysql: stable 5.7.20 (bottled) #数据库版本 Open source relational database management system https://dev.mysql.com/doc/refman/5.7/en/ Conflicts with: mariadb (because mysql, mariadb, and percona install the same binaries.) mariadb-connector-c (because both install plugins) mysql-cluster (because mysql, mariadb, and percona install the same binaries.) mysql-connector-c (because both install MySQL client libraries) percona-server (because mysql, mariadb, and percona install the same binaries.) /usr/local/Cellar/mysql/5.7.20 (324 files, 233.7MB) * #安装的地址; Poured from bottle on 2017-11-06 at 22:59:01 From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/mysql.rb ==> Dependencies Build: cmake ✘ Required: openssl ✔ ==> Requirements Required: macOS >= 10.7 ✔ ==> Options #重要信息 --with-archive-storage-engine To connect run: #链接数据库 ,5.7mysql默认密码为空,所以直接可以链接上数据库 #当然你要使用数据库服务,肯定要启动数据库服务了;下面就是如何启动数据库服务,注意看注释 mysql -uroot Compile with the ARCHIVE storage engine enabled --with-blackhole-storage-engine Compile with the BLACKHOLE storage engine enabled --with-debug Build with debug support --with-embedded Build the embedded server --with-local-infile Build with local infile loading support --with-test Build with unit tests ==> Caveats We've installed your MySQL database without a root password. To secure it run: mysql_secure_installation #这个是执行数据库初始配置的语句 MySQL is configured to only allow connections from localhost by default A "/etc/my.cnf" from another install may interfere with a Homebrew-built # 这句话就是告诉你,不好意思数据库的配置,我们没有,你需要自己写(按照你的需求写); # 数据库也有配置加载的优先级,具体怎么个优先级;下面会介绍 server starting up correctly. # 下面这句话就是告诉你,如果你要数据库在开机的时候就启动呢,就执行下面的语句; To have launchd start mysql now and restart at login: brew services start mysql # 下面这句话告诉我们,如果你不要开机的时候启动数据库服务,就执行下面的语句即可;按需启动数据库服务; Or, if you don't want/need a background service you can just run: mysql.server start
刚刚说到数据库配置文件是没有的,my.cnf这个文件你找不到的,以及数据库配置加载的优先级;
1 2 3 4 5
mysql --help # 你可以看到一大段数据库帮助信息,这个时候你锁定一句 Default options are read from the following files in the given order: /etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf 这句话,就是告诉你,数据库配置的加载顺序,所以你需要新建my.cnf文件,写入你的配置即可;当然,完成后,记得重启数据库服务;