Set up Apache, php, and osx10.9.2apache on MACOSX10.9.2. Set up Apache on MACOSX10.9.2, php, and composer. * with apache, phpApache configuration 1-after sudoapachectlstart is started, access localhost to view Apache, php, and osx10.9.2apache on MAC OSX10.9.2.
Mac osx10.9. * comes with apache and php
Apache configuration
1-start
Sudo apachectl start
After the startup, access http: // localhost/and you will be able to see "It works! "Initial page,
Vi/etc/apache2/httpd. conf
The following code snippet is displayed in row 3:
# # 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.2/mod/core.html#options # for more information. # Options Indexes FollowSymLinks MultiViews # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride None # # Controls who can get stuff from this server. # Order allow,deny Allow from all
Cd/Library/WebServer/Documents Ents
The content of It Works is in index.html. en. this is the apache development page.
2-stop/restart
Sudo apachectl stop
Sudo apachectl restart
3-create a personal site directory
Cd ~
Mkdir Sites
Echo "helloWorld"> index.html
Sudo apachectl restart
Then access http: // localhost /~ Shelley/should be able to see the "helloWorld" personal directory initial page (note:~ ShelleyChange~ Your username)
If it fails
Sudo vi/etc/apache2/users/Guest. conf
Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all
Why must it be the Sites directory name,
Vi/etc/apache2/extra/httpd-userdir.conf
10th rows
# Settings for user home directories## Required module: mod_userdir## UserDir: The name of the directory that is appended onto a user's home# directory if a ~user request is received. Note that you must also set# the default access control for these directories, as in the example below.#UserDir Sites## Users might not be in /Users/*/Sites, so use user-specific config files.#Include /private/etc/apache2/users/*.conf
RegisterUserSite customized-users
4-start the VM
By default, apache's VM function is disabled.
Sudo vi/etc/apache2/httpd. conf
Release comments
#Virtual hosts#Include /private/etc/apache2/extra/httpd-vhosts.conf
Modify file
Sudo vi/etc/apache2/extra/httpd-vhosts.conf
Similar content
NameVirtualHost *:80
DocumentRoot "/Users/shelley/Sites" ServerName www.shelleymyl.com ErrorLog "/Users/shelley/Sites/log/error.log" CustomLog "/Users/shelley/Sites/log/access.log" common
Options Indexes FollowSymLinks MultiViews AllowOverride None Order deny,allow Allow from all
5-URL Forwarding
Open httpd. conf first to make sure the following two lines are not commented out:
LoadModule proxy_module libexec/apache2/mod_proxy.soLoadModule proxy_http_module libexec/apache2/mod_proxy_http.so
Add
ProxyPass /HelloWorldApp http://localhost:8080/HelloWorldApp/
ProxyPassReverse /HelloWorldApp http://localhost:8080/HelloWorldApp/
In this way, access http: // localhost/HelloWorldApp, http: // ip/HelloWorldApp, http://www.shelleymyl.com/HellpWorldApp are equivalent to access http: // localhost: 8080/HelloWorldApp
6-port forwarding
If there is an application http://x.x.x.x on the server: 8080/, if you want to access directly through a domain name similar to the http://www.shelleymyl.com, you need to do port forwarding, still open httpd. conf
LoadModule proxy_connect_module modules/mod_proxy_connect.soLoadModule proxy_ftp_module modules/mod_proxy_ftp.so
Based on "5. URL Forwarding ",
Then modify
Sudo vi/etc/apache2/extra/httpd-vhosts.conf
NameVirtualHost *:80
ProxyPreserveHost On ServerName www.yjmyzz.com ProxyPass / http://www.yjmyzz.com:8000/ ProxyPassReverse / http://www.yjmyzz.com:8000/ ServerAdmin webmaster@localhost
This is equivalent to forwarding port 80 to port 8080.
PHP configuration
PHP configuration is very simple.
Vi/etc/apache2/httpd. conf
LoadModule php5_module libexec/apache2/libphp5.so
Release comments
Then restart sudo apachectl restart and create an index. php file under the Sites folder in the user directory. echo phpinfo () to see the effect:
Reference:
Http://www.cnblogs.com/yjmyzz/p/3920361.html
Http://www.bkjia.com/PHPjc/1110971.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/1110971.htmlTechArticleMAC OSX10.9.2 to build Apache, php, osx10.9.2apache mac osx10.9. * comes with apache, php Apache configuration 1-after starting sudo apachectl start, access http: // localhost/should be able to see...