build php tutorials separately according to online tutorials. At present, php7, has been installed to launch apache access http://localhost:8080
display it works
, but / etc/apache2/httpd.conf
has been modified and / etc/apache2/users/myusername.conf
has been added according to the tutorials. But still can only access http://localhost:8080
display it works and http://localhost:8080/index.html
also show it works
in / Library/WebServer/Documents
and / Users/yi/Sites
(this is the root directory I modified in / etc/apache2/httpd.conf) I have added info.php, Test.html
but
http://localhost:8080/test.html
http://localhost:8080/info.php
http://localhost:8080/~u
all show `Not Found
The requested URL / ~ yi was not found on this server.`
the following are my specific file details.
- httpd.conf
-sharp
-sharp This is the main Apache HTTP server configuration file. It contains the
-sharp configuration directives that give the server its instructions.
-sharp See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
-sharp In particular, see
-sharp <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
-sharp for a discussion of each configuration directive.
-sharp
-sharp Do NOT simply read the instructions in here without understanding
-sharp what they do. They"re here only as hints or reminders. If you are unsure
-sharp consult the online docs. You have been warned.
-sharp
-sharp Configuration and logfile names: If the filenames you specify for many
-sharp of the server"s control files begin with "/" (or "drive:/" for Win32), the
-sharp server will use that explicit path. If the filenames do *not* begin
-sharp with "/", the value of ServerRoot is prepended -- so "logs/access_log"
-sharp with ServerRoot set to "/usr/local/apache2" will be interpreted by the
-sharp server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log"
-sharp will be interpreted as "/logs/access_log".
-sharp
-sharp ServerRoot: The top of the directory tree under which the server"s
-sharp configuration, error, and log files are kept.
-sharp
-sharp Do not add a slash at the end of the directory path. If you point
-sharp ServerRoot at a non-local disk, be sure to specify a local disk on the
-sharp Mutex directive, if file-based mutexes are used. If you wish to share the
-sharp same ServerRoot for multiple httpd daemons, you will need to change at
-sharp least PidFile.
-sharp
ServerRoot "/usr"
-sharp
-sharp Mutex: Allows you to set the mutex mechanism and mutex file directory
-sharp for individual mutexes, or change the global defaults
-sharp
-sharp Uncomment and change the directory if mutexes are file-based and the default
-sharp mutex file directory is not on a local disk or is not appropriate for some
-sharp other reason.
-sharp
-sharp Mutex default:/private/var/run
-sharp
-sharp Listen: Allows you to bind Apache to specific IP addresses and/or
-sharp ports, instead of the default. See also the <VirtualHost>
-sharp directive.
-sharp
-sharp Change this to Listen on specific IP addresses as shown below to
-sharp prevent Apache from glomming onto all bound IP addresses.
-sharp
-sharpListen 12.34.56.78:80
Listen 80
-sharp
-sharp Dynamic Shared Object (DSO) Support
-sharp
-sharp To be able to use the functionality of a module which was built as a DSO you
-sharp have to place corresponding `LoadModule" lines at this location so the
-sharp directives contained in it are actually available _before_ they are used.
-sharp Statically compiled modules (those listed by `httpd -l") do not need
-sharp to be loaded here.
-sharp
-sharp Example:
-sharp LoadModule foo_module modules/mod_foo.so
-sharp
LoadModule authn_file_module libexec/apache2/mod_authn_file.so
-sharpLoadModule authn_dbm_module libexec/apache2/mod_authn_dbm.so
-sharpLoadModule authn_anon_module libexec/apache2/mod_authn_anon.so
-sharpLoadModule authn_dbd_module libexec/apache2/mod_authn_dbd.so
-sharpLoadModule authn_socache_module libexec/apache2/mod_authn_socache.so
LoadModule authn_core_module libexec/apache2/mod_authn_core.so
LoadModule authz_host_module libexec/apache2/mod_authz_host.so
LoadModule authz_groupfile_module libexec/apache2/mod_authz_groupfile.so
LoadModule authz_user_module libexec/apache2/mod_authz_user.so
-sharpLoadModule authz_dbm_module libexec/apache2/mod_authz_dbm.so
-sharpLoadModule authz_owner_module libexec/apache2/mod_authz_owner.so
-sharpLoadModule authz_dbd_module libexec/apache2/mod_authz_dbd.so
LoadModule authz_core_module libexec/apache2/mod_authz_core.so
-sharpLoadModule authnz_ldap_module libexec/apache2/mod_authnz_ldap.so
LoadModule access_compat_module libexec/apache2/mod_access_compat.so
LoadModule auth_basic_module libexec/apache2/mod_auth_basic.so
-sharpLoadModule auth_form_module libexec/apache2/mod_auth_form.so
-sharpLoadModule auth_digest_module libexec/apache2/mod_auth_digest.so
-sharpLoadModule allowmethods_module libexec/apache2/mod_allowmethods.so
-sharpLoadModule file_cache_module libexec/apache2/mod_file_cache.so
-sharpLoadModule cache_module libexec/apache2/mod_cache.so
-sharpLoadModule cache_disk_module libexec/apache2/mod_cache_disk.so
-sharpLoadModule cache_socache_module libexec/apache2/mod_cache_socache.so
-sharpLoadModule socache_shmcb_module libexec/apache2/mod_socache_shmcb.so
-sharpLoadModule socache_dbm_module libexec/apache2/mod_socache_dbm.so
-sharpLoadModule socache_memcache_module libexec/apache2/mod_socache_memcache.so
-sharpLoadModule watchdog_module libexec/apache2/mod_watchdog.so
-sharpLoadModule macro_module libexec/apache2/mod_macro.so
-sharpLoadModule dbd_module libexec/apache2/mod_dbd.so
-sharpLoadModule dumpio_module libexec/apache2/mod_dumpio.so
-sharpLoadModule echo_module libexec/apache2/mod_echo.so
-sharpLoadModule buffer_module libexec/apache2/mod_buffer.so
-sharpLoadModule data_module libexec/apache2/mod_data.so
-sharpLoadModule ratelimit_module libexec/apache2/mod_ratelimit.so
LoadModule reqtimeout_module libexec/apache2/mod_reqtimeout.so
-sharpLoadModule ext_filter_module libexec/apache2/mod_ext_filter.so
-sharpLoadModule request_module libexec/apache2/mod_request.so
LoadModule include_module libexec/apache2/mod_include.so
LoadModule filter_module libexec/apache2/mod_filter.so
-sharpLoadModule reflector_module libexec/apache2/mod_reflector.so
-sharpLoadModule substitute_module libexec/apache2/mod_substitute.so
-sharpLoadModule sed_module libexec/apache2/mod_sed.so
-sharpLoadModule charset_lite_module libexec/apache2/mod_charset_lite.so
-sharpLoadModule deflate_module libexec/apache2/mod_deflate.so
-sharpLoadModule xml2enc_module libexec/apache2/mod_xml2enc.so
-sharpLoadModule proxy_html_module libexec/apache2/mod_proxy_html.so
LoadModule mime_module libexec/apache2/mod_mime.so
-sharpLoadModule ldap_module libexec/apache2/mod_ldap.so
LoadModule log_config_module libexec/apache2/mod_log_config.so
-sharpLoadModule log_debug_module libexec/apache2/mod_log_debug.so
-sharpLoadModule log_forensic_module libexec/apache2/mod_log_forensic.so
-sharpLoadModule logio_module libexec/apache2/mod_logio.so
LoadModule env_module libexec/apache2/mod_env.so
-sharpLoadModule mime_magic_module libexec/apache2/mod_mime_magic.so
-sharpLoadModule expires_module libexec/apache2/mod_expires.so
LoadModule headers_module libexec/apache2/mod_headers.so
-sharpLoadModule usertrack_module libexec/apache2/mod_usertrack.so
-sharp-sharpLoadModule unique_id_module libexec/apache2/mod_unique_id.so
LoadModule setenvif_module libexec/apache2/mod_setenvif.so
LoadModule version_module libexec/apache2/mod_version.so
-sharpLoadModule remoteip_module libexec/apache2/mod_remoteip.so
LoadModule proxy_module libexec/apache2/mod_proxy.so
LoadModule proxy_connect_module libexec/apache2/mod_proxy_connect.so
LoadModule proxy_ftp_module libexec/apache2/mod_proxy_ftp.so
LoadModule proxy_http_module libexec/apache2/mod_proxy_http.so
LoadModule proxy_fcgi_module libexec/apache2/mod_proxy_fcgi.so
LoadModule proxy_scgi_module libexec/apache2/mod_proxy_scgi.so
-sharpLoadModule proxy_fdpass_module libexec/apache2/mod_proxy_fdpass.so
LoadModule proxy_wstunnel_module libexec/apache2/mod_proxy_wstunnel.so
LoadModule proxy_ajp_module libexec/apache2/mod_proxy_ajp.so
LoadModule proxy_balancer_module libexec/apache2/mod_proxy_balancer.so
LoadModule proxy_express_module libexec/apache2/mod_proxy_express.so
-sharpLoadModule session_module libexec/apache2/mod_session.so
-sharpLoadModule session_cookie_module libexec/apache2/mod_session_cookie.so
-sharpLoadModule session_dbd_module libexec/apache2/mod_session_dbd.so
LoadModule slotmem_shm_module libexec/apache2/mod_slotmem_shm.so
-sharpLoadModule slotmem_plain_module libexec/apache2/mod_slotmem_plain.so
-sharpLoadModule ssl_module libexec/apache2/mod_ssl.so
-sharpLoadModule dialup_module libexec/apache2/mod_dialup.so
LoadModule lbmethod_byrequests_module libexec/apache2/mod_lbmethod_byrequests.so
LoadModule lbmethod_bytraffic_module libexec/apache2/mod_lbmethod_bytraffic.so
LoadModule lbmethod_bybusyness_module libexec/apache2/mod_lbmethod_bybusyness.so
-sharpLoadModule lbmethod_heartbeat_module libexec/apache2/mod_lbmethod_heartbeat.so
LoadModule unixd_module libexec/apache2/mod_unixd.so
-sharpLoadModule heartbeat_module libexec/apache2/mod_heartbeat.so
-sharpLoadModule heartmonitor_module libexec/apache2/mod_heartmonitor.so
-sharpLoadModule dav_module libexec/apache2/mod_dav.so
LoadModule status_module libexec/apache2/mod_status.so
LoadModule autoindex_module libexec/apache2/mod_autoindex.so
-sharpLoadModule asis_module libexec/apache2/mod_asis.so
-sharpLoadModule info_module libexec/apache2/mod_info.so
-sharpLoadModule cgi_module libexec/apache2/mod_cgi.so
-sharpLoadModule dav_fs_module libexec/apache2/mod_dav_fs.so
-sharpLoadModule dav_lock_module libexec/apache2/mod_dav_lock.so
-sharpLoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so
LoadModule negotiation_module libexec/apache2/mod_negotiation.so
LoadModule dir_module libexec/apache2/mod_dir.so
-sharpLoadModule imagemap_module libexec/apache2/mod_imagemap.so
-sharpLoadModule actions_module libexec/apache2/mod_actions.so
-sharpLoadModule speling_module libexec/apache2/mod_speling.so
LoadModule userdir_module libexec/apache2/mod_userdir.so
LoadModule alias_module libexec/apache2/mod_alias.so
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
-sharpLoadModule php5_module libexec/apache2/libphp5.so
LoadModule hfs_apple_module libexec/apache2/mod_hfs_apple.so
<IfModule unixd_module>
-sharp
-sharp If you wish httpd to run as a different user or group, you must run
-sharp httpd as root initially and it will switch.
-sharp
-sharp User/Group: The name (or -sharpnumber) of the user/group to run httpd as.
-sharp It is usually good practice to create a dedicated user and group for
-sharp running httpd, as with most system services.
-sharp
User _www
Group _www
</IfModule>
-sharp "Main" server configuration
-sharp
-sharp The directives in this section set up the values used by the "main"
-sharp server, which responds to any requests that aren"t handled by a
-sharp <VirtualHost> definition. These values also provide defaults for
-sharp any <VirtualHost> containers you may define later in the file.
-sharp
-sharp All of these directives may appear inside <VirtualHost> containers,
-sharp in which case these default settings will be overridden for the
-sharp virtual host being defined.
-sharp
-sharp
-sharp ServerAdmin: Your address, where problems with the server should be
-sharp e-mailed. This address appears on some server-generated pages, such
-sharp as error documents. e.g. admin@your-domain.com
-sharp
ServerAdmin you@example.com
-sharp
-sharp ServerName gives the name and port that the server uses to identify itself.
-sharp This can often be determined automatically, but we recommend you specify
-sharp it explicitly to prevent problems during startup.
-sharp
-sharp If your host doesn"t have a registered DNS name, enter its IP address here.
-sharp
-sharpServerName www.example.com:80
-sharp
-sharp Deny access to the entirety of your server"s filesystem. You must
-sharp explicitly permit access to web content directories in other
-sharp <Directory> blocks below.
-sharp
<Directory />
AllowOverride None
-sharp Require all denied
Require all granted
</Directory>
-sharp
-sharp Note that from this point forward you must specifically allow
-sharp particular features to be enabled - so if something"s not working as
-sharp you might expect, make sure that you have specifically enabled it
-sharp below.
-sharp
-sharp
-sharp DocumentRoot: The directory out of which you will serve your
-sharp documents. By default, all requests are taken from this directory, but
-sharp symbolic links and aliases may be used to point to other locations.
-sharp
-sharp DocumentRoot "/Library/WebServer/Documents"
DocumentRoot "/Users/yi/Sites"
<Directory "/Users/yi/Sites">
-sharp
-sharp Possible values for the Options directive are "None", "All",
-sharp or any combination of:
-sharp Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
-sharp
-sharp Note that "MultiViews" must be named *explicitly* --- "Options All"
-sharp doesn"t give it to you.
-sharp
-sharp The Options directive is both complicated and important. Please see
-sharp http://httpd.apache.org/docs/2.4/mod/core.html-sharpoptions
-sharp for more information.
-sharp
-sharpOptions FollowSymLinks Multiviews
Options FollowSymLinks Multiviews Indexes
MultiviewsMatch Any
-sharp
-sharp AllowOverride controls what directives may be placed in .htaccess files.
-sharp It can be "All", "None", or any combination of the keywords:
-sharp AllowOverride FileInfo AuthConfig Limit
-sharp
AllowOverride None
-sharp
-sharp Controls who can get stuff from this server.
-sharp
Require all granted
</Directory>
-sharp
-sharp DirectoryIndex: sets the file that Apache will serve if a directory
-sharp is requested.
-sharp
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
-sharp
-sharp The following lines prevent .htaccess and .htpasswd files from being
-sharp viewed by Web clients.
-sharp
<FilesMatch "^\.([Hh][Tt]|[Dd][Ss]_[Ss])">
Require all denied
</FilesMatch>
-sharp
-sharp Apple specific filesystem protection.
-sharp
<Files "rsrc">
Require all denied
</Files>
<DirectoryMatch ".*\.\.namedfork">
Require all denied
</DirectoryMatch>
-sharp
-sharp ErrorLog: The location of the error log file.
-sharp If you do not specify an ErrorLog directive within a <VirtualHost>
-sharp container, error messages relating to that virtual host will be
-sharp logged here. If you *do* define an error logfile for a <VirtualHost>
-sharp container, that host"s errors will be logged there and not here.
-sharp
ErrorLog "/private/var/log/apache2/error_log"
-sharp
-sharp LogLevel: Control the number of messages logged to the error_log.
-sharp Possible values include: debug, info, notice, warn, error, crit,
-sharp alert, emerg.
-sharp
LogLevel warn
<IfModule log_config_module>
-sharp
-sharp The following directives define some format nicknames for use with
-sharp a CustomLog directive (see below).
-sharp
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>
-sharp 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>
-sharp
-sharp The location and format of the access logfile (Common Logfile Format).
-sharp If you do not define any access logfiles within a <VirtualHost>
-sharp container, they will be logged here. Contrariwise, if you *do*
-sharp define per-<VirtualHost> access logfiles, transactions will be
-sharp logged therein and *not* in this file.
-sharp
CustomLog "/private/var/log/apache2/access_log" common
-sharp
-sharp If you prefer a logfile with access, agent, and referer information
-sharp (Combined Logfile Format) you can use the following directive.
-sharp
-sharpCustomLog "/private/var/log/apache2/access_log" combined
</IfModule>
<IfModule alias_module>
-sharp
-sharp Redirect: Allows you to tell clients about documents that used to
-sharp exist in your server"s namespace, but do not anymore. The client
-sharp will make a new request for the document at its new location.
-sharp Example:
-sharp Redirect permanent /foo http://www.example.com/bar
-sharp
-sharp Alias: Maps web paths into filesystem paths and is used to
-sharp access content that does not live under the DocumentRoot.
-sharp Example:
-sharp Alias /webpath /full/filesystem/path
-sharp
-sharp If you include a trailing / on /webpath then the server will
-sharp require it to be present in the URL. You will also likely
-sharp need to provide a <Directory> section to allow access to
-sharp the filesystem path.
-sharp
-sharp ScriptAlias: This controls which directories contain server scripts.
-sharp ScriptAliases are essentially the same as Aliases, except that
-sharp documents in the target directory are treated as applications and
-sharp run by the server when requested rather than as documents sent to the
-sharp client. The same rules about trailing "/" apply to ScriptAlias
-sharp directives as to Alias.
-sharp
ScriptAliasMatch ^/cgi-bin/((?!(?i:webobjects)).*$) "/Library/WebServer/CGI-Executables/$1"
</IfModule>
<IfModule cgid_module>
-sharp
-sharp ScriptSock: On threaded servers, designate the path to the UNIX
-sharp socket used to communicate with the CGI daemon of mod_cgid.
-sharp
-sharpScriptsock cgisock
</IfModule>
-sharp
-sharp "/Library/WebServer/CGI-Executables" should be changed to whatever your ScriptAliased
-sharp CGI directory exists, if you have that configured.
-sharp
<Directory "/Library/WebServer/CGI-Executables">
AllowOverride None
Options None
Require all granted
</Directory>
<IfModule mime_module>
-sharp
-sharp TypesConfig points to the file containing the list of mappings from
-sharp filename extension to MIME-type.
-sharp
TypesConfig /private/etc/apache2/mime.types
-sharp
-sharp AddType allows you to add to or override the MIME configuration
-sharp file specified in TypesConfig for specific file types.
-sharp
-sharpAddType application/x-gzip .tgz
-sharp
-sharp AddEncoding allows you to have certain browsers uncompress
-sharp information on the fly. Note: Not all browsers support this.
-sharp
-sharpAddEncoding x-compress .Z
-sharpAddEncoding x-gzip .gz .tgz
-sharp
-sharp If the AddEncoding directives above are commented-out, then you
-sharp probably should define those extensions to indicate media types:
-sharp
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
-sharp
-sharp AddHandler allows you to map certain file extensions to "handlers":
-sharp actions unrelated to filetype. These can be either built into the server
-sharp or added with the Action directive (see below)
-sharp
-sharp To use CGI scripts outside of ScriptAliased directories:
-sharp (You will also need to add "ExecCGI" to the "Options" directive.)
-sharp
-sharpAddHandler cgi-script .cgi
-sharp For type maps (negotiated resources):
-sharpAddHandler type-map var
-sharp
-sharp Filters allow you to process content before it is sent to the client.
-sharp
-sharp To parse .shtml files for server-side includes (SSI):
-sharp (You will also need to add "Includes" to the "Options" directive.)
-sharp
-sharpAddType text/html .shtml
-sharpAddOutputFilter INCLUDES .shtml
</IfModule>
-sharp
-sharp The mod_mime_magic module allows the server to use various hints from the
-sharp contents of the file itself to determine its type. The MIMEMagicFile
-sharp directive tells the module where the hint definitions are located.
-sharp
-sharpMIMEMagicFile /private/etc/apache2/magic
-sharp
-sharp Customizable error responses come in three flavors:
-sharp 1) plain text 2) local redirects 3) external redirects
-sharp
-sharp Some examples:
-sharpErrorDocument 500 "The server made a boo boo."
-sharpErrorDocument 404 /missing.html
-sharpErrorDocument 404 "/cgi-bin/missing_handler.pl"
-sharpErrorDocument 402 http://www.example.com/subscription_info.html
-sharp
-sharp
-sharp MaxRanges: Maximum number of Ranges in a request before
-sharp returning the entire resource, or one of the special
-sharp values "default", "none" or "unlimited".
-sharp Default setting is to accept 200 Ranges.
-sharpMaxRanges unlimited
-sharp
-sharp EnableMMAP and EnableSendfile: On systems that support it,
-sharp memory-mapping or the sendfile syscall may be used to deliver
-sharp files. This usually improves server performance, but must
-sharp be turned off when serving from networked-mounted
-sharp filesystems or if support for these functions is otherwise
-sharp broken on your system.
-sharp Defaults: EnableMMAP On, EnableSendfile Off
-sharp
-sharpEnableMMAP off
-sharpEnableSendfile on
TraceEnable off
-sharp Supplemental configuration
-sharp
-sharp The configuration files in the /private/etc/apache2/extra/ directory can be
-sharp included to add extra features or to modify the default configuration of
-sharp the server, or you may simply copy their contents here and change as
-sharp necessary.
-sharp Server-pool management (MPM specific)
Include /private/etc/apache2/extra/httpd-mpm.conf
-sharp Multi-language error messages
-sharpInclude /private/etc/apache2/extra/httpd-multilang-errordoc.conf
-sharp Fancy directory listings
Include /private/etc/apache2/extra/httpd-autoindex.conf
-sharp Language settings
-sharpInclude /private/etc/apache2/extra/httpd-languages.conf
-sharp User home directories
Include /private/etc/apache2/extra/httpd-userdir.conf
-sharp Real-time info on requests and configuration
-sharpInclude /private/etc/apache2/extra/httpd-info.conf
-sharp Virtual hosts
-sharpInclude /private/etc/apache2/extra/httpd-vhosts.conf
-sharp Local access to the Apache HTTP Server Manual
-sharpInclude /private/etc/apache2/extra/httpd-manual.conf
-sharp Distributed authoring and versioning (WebDAV)
-sharpInclude /private/etc/apache2/extra/httpd-dav.conf
-sharp Various default settings
-sharpInclude /private/etc/apache2/extra/httpd-default.conf
-sharp Configure mod_proxy_html to understand HTML4/XHTML1
<IfModule proxy_html_module>
Include /private/etc/apache2/extra/proxy-html.conf
</IfModule>
-sharp Secure (SSL/TLS) connections
-sharpInclude /private/etc/apache2/extra/httpd-ssl.conf
-sharp
-sharp Note: The following must must be present to support
-sharp starting without SSL on platforms with no /dev/random equivalent
-sharp but a statically compiled-in mod_ssl.
-sharp
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
-sharpInclude /private/etc/apache2/other/*.conf
-sharp ====php module====
LoadModule php7_module /usr/local/opt/php70/libexec/apache2/libphp7.so -sharp(brew php)
<IfModule mod_php7.c>
-sharp php
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
<IfModule mod_dir.c>
DirectoryIndex index.html index.php
</IfModule>
</IfModule>
- yi.conf (my username) (has been granted 755)
AllowOverride All
Options Indexes MultiViews FollowSymLinks
Require all granted
</Directory>
(a little bit of nonsense, but I really can"t find a solution after two days of hard work. I"d appreciate your advice!