问题描述
我已阅读有关此问题的其他帖子和文章,但没有一个解决方案对我有用。我将一个实时站点复制到 MAMP 并上传了现有数据库。主页在 MAMP 中正确显示,但每个子页面和 /user 都会导致 404 错误。输入管理员 URL 确实会正确返回拒绝访问页面:http://produceavailable-drupal7.local/admin/reports/status
文件夹是:
drwxrwxr-x 33 emd2020 staff 1056 Feb 6 15:59 produceavailable-drupal7
文件是:
-rw-r--r--@ 1 emd2020 staff 529 Nov 17 22:07 index.PHP
我已更改的内容:
settings.PHP
$databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'produce7','username' => 'root','password' => 'root','host' => 'localhost','port' => '','driver' => 'MysqL','prefix' => '',),);
终端 sudo vi /etc/hosts:
# Host Database
##
127.0.0.1 produceavailable-drupal7.local
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
~
httpd.conf
# The main Apache HTTP server configuration file.
#
ServerRoot "/Applications/MAMP/Library"
#
# PidFile: The file in which the server should record its process
# identification number when it starts.
#
<IfModule !mpm_netware.c>
PidFile logs/httpd.pid
</IfModule>
#
# Mutex default:"/Applications/MAMP/Library/logs"
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule allowmethods_module modules/mod_allowmethods.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule auth_form_module modules/mod_auth_form.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_socache_module modules/mod_authn_socache.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule authz_dbd_module modules/mod_authz_dbd.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule bucketeer_module modules/mod_bucketeer.so
LoadModule buffer_module modules/mod_buffer.so
LoadModule cache_module modules/mod_cache.so
LoadModule case_filter_in_module modules/mod_case_filter_in.so
LoadModule case_filter_module modules/mod_case_filter.so
LoadModule cern_Meta_module modules/mod_cern_Meta.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule cgid_module modules/mod_cgid.so
LoadModule charset_lite_module modules/mod_charset_lite.so
LoadModule dav_module modules/mod_dav.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule dir_module modules/mod_dir.so
LoadModule dumpio_module modules/mod_dumpio.so
LoadModule echo_module modules/mod_echo.so
LoadModule env_module modules/mod_env.so
LoadModule expires_module modules/mod_expires.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule fastcgi_module modules/mod_fastcgi.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule filter_module modules/mod_filter.so
LoadModule headers_module modules/mod_headers.so
LoadModule http2_module modules/mod_http2.so
LoadModule include_module modules/mod_include.so
LoadModule info_module modules/mod_info.so
LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so
LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so
#LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule log_debug_module modules/mod_log_debug.so
LoadModule logio_module modules/mod_logio.so
LoadModule macro_module modules/mod_macro.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule perl_module modules/mod_perl.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule ratelimit_module modules/mod_ratelimit.so
LoadModule remoteip_module modules/mod_remoteip.so
LoadModule reqtimeout_module modules/mod_reqtimeout.so
LoadModule request_module modules/mod_request.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule sed_module modules/mod_sed.so
LoadModule session_module modules/mod_session.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
LoadModule socache_dbm_module modules/mod_socache_dbm.so
LoadModule socache_memcache_module modules/mod_socache_memcache.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
LoadModule speling_module modules/mod_speling.so
#
# Starting v5.7 ssl_module is statically compiled into Apache and
# doesn't need to be enabled / can not be disabled.
#
LoadModule status_module modules/mod_status.so
LoadModule substitute_module modules/mod_substitute.so
#LoadModule unique_id_module modules/mod_unique_id.so
LoadModule unixd_module modules/mod_unixd.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule version_module modules/mod_version.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule watchdog_module modules/mod_watchdog.so
LoadModule wsgi_module modules/mod_wsgi.so
LoadModule xsendfile_module modules/mod_xsendfile.so
LoadModule PHP5_module /Applications/MAMP/bin/PHP/PHP5.6.40/modules/libPHP5.so
#
AddType application/x-httpd-PHP .PHP .phtml
<IfModule unixd_module>
#
# If you wish httpd to run as a different user or group,you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd,as with most system services.
#
User emd2020
Group #-1
</IfModule>
<IfModule xsendfile_module>
XSendFile on
</IfModule>
# 'Main' server configuration
#
# ServerAdmin: Your address,where problems with the server should be
# e-mailed. This address appears on some server-generated pages,such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin you@example.com
#
ServerName localhost:80
#
# MAMP DOCUMENT_ROOT !! Don't remove this line !!
DocumentRoot "/Applications/MAMP/htdocs"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First,we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect,make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/Applications/MAMP/htdocs">
#
# 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 All
#
# 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 All
#
# Controls who can get stuff from this server.
#
Require all granted
XSendFilePath "/Applications/MAMP/htdocs"
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.PHP
<IfModule perl_module>
DirectoryIndex index.pl
</IfModule>
<IfModule wsgi_module>
DirectoryIndex index.wsgi index.py
</IfModule>
</IfModule>
#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives. See also the AllowOverride
# directive.
#
AccessFileName .htaccess
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
Require all denied
Satisfy All
</FilesMatch>
<Files ~ "^\.DS_Store">
Require all denied
</Files>
#
# ErrorLog: The location of the error log file.
#
ErrorLog "/Applications/MAMP/logs/apache_error.log"
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug,info,notice,warn,error,crit,# alert,emerg.
#
LogLevel error
<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>
#
# The location and format of the access logfile (Common Logfile Format).
#
CustomLog "/Applications/MAMP/logs/apache_access.log" combined
</IfModule>
<IfModule alias_module>
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# We include the /icons/ alias for FancyIndexed directory listings. If you
# do not use FancyIndexing,you may comment this out.
#
Alias /favicon.ico "/Applications/MAMP/bin/favicon.ico"
Alias /icons/ "/Applications/MAMP/Library/icons/"
<Directory "/Applications/MAMP/Library/icons">
Options Indexes MultiViews
AllowOverride None
Require all granted
</Directory>
Alias /PHPMyAdmin "/Applications/MAMP/bin/PHPMyAdmin"
Alias /PHPmyadmin "/Applications/MAMP/bin/PHPMyAdmin"
<Directory "/Applications/MAMP/bin/PHPMyAdmin">
Options Indexes MultiViews
AllowOverride None
Require all granted
</Directory>
Alias /PHPPgAdmin "/Applications/MAMP/bin/PHPPgAdmin"
Alias /PHPpgadmin "/Applications/MAMP/bin/PHPPgAdmin"
<Directory "/Applications/MAMP/bin/PHPPgAdmin">
Options Indexes MultiViews
AllowOverride None
Require all granted
</Directory>
Alias /PHPLiteAdmin "/Applications/MAMP/bin/PHPLiteAdmin"
Alias /PHPliteadmin "/Applications/MAMP/bin/PHPLiteAdmin"
<Directory "/Applications/MAMP/bin/PHPLiteAdmin">
Options Indexes MultiViews
AllowOverride None
Require all granted
</Directory>
Alias /MAMP "/Applications/MAMP/bin/mamp"
<Directory "/Applications/MAMP/bin/mamp">
Options Indexes MultiViews
AllowOverride None
Require all granted
</Directory>
Alias /adminer "/Applications/MAMP/bin/adminer"
<Directory "/Applications/MAMP/bin/adminer">
DirectoryIndex adminer.PHP
Options Indexes MultiViews
AllowOverride None
Require all granted
</Directory>
#
# ScriptAlias: This controls which directories contain server scripts.
#
ScriptAlias /cgi-bin/ "/Applications/MAMP/cgi-bin/"
Alias /perl/ "/Applications/MAMP/cgi-bin/"
<IfModule perl_module>
PerlModule ModPerl::Registry
<Location /perl>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
</Location>
</IfModule>
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers,designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock logs/cgisock
</IfModule>
#
# "/Applications/MAMP/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists,if you have that configured.
#
<Directory "/Applications/MAMP/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
<IfModule headers_module>
#
# Avoid passing HTTP_PROXY environment to CGI's on this or any proxied
# backend servers which have lingering "httpoxy" defects.
# 'Proxy' request header is undefined by the IETF,not listed by IANA
#
RequestHeader unset Proxy early
</IfModule>
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one,such as from filename extensions.
# If your server contains mostly text or HTML documents,"text/plain" is
# a good value. If most of your content is binary,such as applications
# or images,you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig /Applications/MAMP/conf/apache/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out,then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
AddHandler cgi-script .cgi .pl
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
#
# The mod_mime_magic module allows the server to use varIoUs hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint deFinitions are located.
#
<IfModule mime_magic_module>
MIMEMagicFile /Applications/MAMP/conf/apache/magic
</IfModule>
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# Maxranges: Maximum number of Ranges in a request before
# returning the entire resource,or one of the special
# values 'default','none' or 'unlimited'.
# Default setting is to accept 200 Ranges.
#Maxranges unlimited
#
# EnablemmAP and EnableSendfile: On systems that support it,# memory-mapping or the sendfile syscall may be used to deliver
# files. This usually improves server performance,but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
# Defaults: EnablemmAP On,EnableSendfile Off
#
#EnablemmAP off
#EnableSendfile off
# Supplemental configuration
#
# The configuration files in the /Applications/MAMP/conf/apache/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server,or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
#Include /Applications/MAMP/conf/apache/extra/httpd-mpm.conf
# Multi-language error messages
#Include /Applications/MAMP/conf/apache/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include /Applications/MAMP/conf/apache/extra/httpd-autoindex.conf
# Language settings
#Include /Applications/MAMP/conf/apache/extra/httpd-languages.conf
# User home directories
#Include /Applications/MAMP/conf/apache/extra/httpd-userdir.conf
# Real-time info on requests and configuration
#Include /Applications/MAMP/conf/apache/extra/httpd-info.conf
# Virtual hosts
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include /Applications/MAMP/conf/apache/extra/httpd-manual.conf
# distributed authoring and versioning (WebDAV)
#Include /Applications/MAMP/conf/apache/extra/httpd-dav.conf
# VarIoUs default settings
#Include /Applications/MAMP/conf/apache/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include /Applications/MAMP/conf/apache/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup file:/dev/urandom 1024
SSLRandomSeed connect file:/dev/urandom 1024
#
# Uncomment the next line if Apache should not accept SSLv3 connections,to learn more google for "POODLE SSLv3".
# SSLProtocol All -SSLv2 -SSLv3
</IfModule>
httpd-vhosts.conf
# Virtual Hosts
#
# required modules: mod_log_config
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
DocumentRoot "/Applications/MAMP/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Users/emd2020/Sites/produceavailable-drupal7"
ServerName produceavailable-drupal7.local
</VirtualHost>
.htaccess
#
# Apache/PHP/Drupal settings:
#
# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.PHP)?|xtmpl)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\.(?!well-kNown).*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock)|web\.config)$|^#.*#$|\.PHP(~|\.sw[op]|\.bak|\.orig\.save)$">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
</IfModule>
</FilesMatch>
# Don't show directory listings for URLs which map to a directory.
Options -Indexes
# Follow symbolic links in this directory.
Options +FollowSymLinks
# Make Drupal handle any 404 errors.
ErrorDocument 404 /index.PHP
# Set the default handler.
DirectoryIndex index.PHP index.html index.htm
# Override PHP settings that cannot be changed at runtime. See
# sites/default/default.settings.PHP and drupal_environment_initialize() in
# includes/bootstrap.inc for settings that can be changed at runtime.
# PHP 5,Apache 1 and 2.
<IfModule mod_PHP5.c>
PHP_flag magic_quotes_gpc off
PHP_flag magic_quotes_sybase off
PHP_flag register_globals off
PHP_flag session.auto_start off
PHP_value mbstring.http_input pass
PHP_value mbstring.http_output pass
PHP_flag mbstring.encoding_translation off
</IfModule>
# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
# Enable expirations.
ExpiresActive On
# Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600
<FilesMatch \.PHP$>
# Do not allow PHP scripts to be cached unless they explicitly send cache
# headers themselves. Otherwise all scripts would have to overwrite the
# headers set by mod_expires if they want another caching behavior. This may
# fail if an error occurs early in the bootstrap process,and it may cause
# problems if a non-Drupal PHP file is installed in a subdirectory.
ExpiresActive Off
</FilesMatch>
</IfModule>
# VarIoUs rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on
# Set "protossl" to "s" if we were accessed via https://. This is used later
# if you enable "www." stripping or enforcement,in order to ensure that
# you don't bounce between http and https.
RewriteRule ^ - [E=protossl]
RewriteCond %{HTTPS} on
RewriteRule ^ - [E=protossl:s]
# Make sure Authorization HTTP header is available to PHP
# even when running as CGI or FastCGI.
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Block access to "hidden" directories whose names begin with a period. This
# includes directories used by version control systems such as Subversion or
# Git to store control files. Files whose names begin with a period,as well
# as the control files used by CVS,are protected by the FilesMatch directive
# above.
#
# NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite,it is
# not possible to block access to entire directories from .htaccess,because
# <DirectoryMatch> is not allowed here.
#
# If you do not have mod_rewrite installed,you should remove these
# directories from your webroot or otherwise protect them from being
# downloaded.
RewriteRule "/\.|^\.(?!well-kNown/)" - [F]
# If your site can be accessed both with and without the 'www.' prefix,you
# can use one of the following settings to redirect users to your preferred
# URL,either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
#
# To redirect all users to access the site WITH the 'www.' prefix,# (http://example.com/... will be redirected to http://www.example.com/...)
# uncomment the following:
# RewriteCond %{HTTP_HOST} .
# RewriteCond %{HTTP_HOST} !^www\. [NC]
# RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#
# To redirect all users to access the site WITHOUT the 'www.' prefix,# (http://www.example.com/... will be redirected to http://example.com/...)
# uncomment the following:
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
# RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]
# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /drupal
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,# uncomment the following line:
# RewriteBase /
# Pass all requests not referring directly to files in the filesystem to
# index.PHP. Clean URLs are handled in drupal_environment_initialize().
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.PHP [L]
# Rules to correctly serve gzip compressed CSS and JS files.
# Requires both mod_rewrite and mod_headers to be enabled.
<IfModule mod_headers.c>
# Serve gzip compressed CSS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.css $1\.css\.gz [QSA]
# Serve gzip compressed JS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.js $1\.js\.gz [QSA]
# Serve correct content types,and prevent mod_deflate double gzip.
RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]
RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]
<FilesMatch "(\.js\.gz|\.css\.gz)$">
# Serve correct encoding type.
Header set content-encoding gzip
# Force proxies to cache gzipped & non-gzipped css/js files separately.
Header append vary Accept-Encoding
</FilesMatch>
</IfModule>
</IfModule>
# Add headers to all responses.
<IfModule mod_headers.c>
# disable content sniffing,since it's an attack vector.
Header always set X-Content-Type-Options nosniff
</IfModule>
端口设置为 80。MysqL 端口为 3306。
我不知道还能尝试什么。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)