web-dev-qa-db-ja.com

サーバーのリリース後、16.04から18.04にアップグレードすると、ウェブサイトにアクセスできません(ドロップレット)

ドメインを入力すると、次のようになります。

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.
Apache/2.4.29 (Ubuntu) Server at www.mywebsite.net Port 443

私のエラーログでこれを見つけました:

/var/www/html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration, referer: https://www.google.lv/

私のPHP php -vを実行しているバージョン

PHP 7.2.10-0ubuntu0.18.04.1 (cli) (built: Sep 13 2018 13:45:02) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.10-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies

私の.htaccessにこれがあります

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_Host} ^165\.227\.175\.218$
RewriteRule ^(.*)$ http://www.mywebsite.net/$1 [L,R=301]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# Wordfence WAF
<IfModule mod_php7.c>
php_value auto_prepend_file '/var/www/html/mywebsite/public_html/wordfence-waf.php'

/var/www/html/mywebsite/public_html/wordfence-waf.phpにこれがあります:

<?php
// Before removing this file, please verify the PHP ini setting          `auto_prepend_file` does not point to this.

 if (file_exists('/var/www/html/mywebsite/public_html/wp-content/plugins /wordfence/waf/bootstrap.php')) {
define("WFWAF_LOG_PATH", '/var/www/html/mywebsite/public_html/wp-content  /wflogs/');
include_once '/var/www/html/mywebsite/public_html/wp-content/plugins/wordfence/waf/bootstrap.php';
}
?>    

私は試した:

Sudo a2enmod rewrite && Sudo service Apache2 restart
/etc/Host.conf: line 3: bad command `nospoof on'
Module rewrite already enabled
/etc/Host.conf: line 3: bad command `nospoof on'

/ usr/sbin/Apache2 -V | grep MPM

[Tue Jan 08 12:05:13.506757 2019] [core:warn] [pid 6361] AH00111: Config   variabl e ${Apache_LOCK_DIR} is not defined
[Tue Jan 08 12:05:13.506990 2019] [core:warn] [pid 6361] AH00111: Config variabl e ${Apache_PID_FILE} is not defined
[Tue Jan 08 12:05:13.507254 2019] [core:warn] [pid 6361] AH00111: Config variabl e ${Apache_RUN_USER} is not defined
[Tue Jan 08 12:05:13.507358 2019] [core:warn] [pid 6361] AH00111: Config variabl e ${Apache_RUN_GROUP} is not defined
[Tue Jan 08 12:05:13.507469 2019] [core:warn] [pid 6361] AH00111: Config variabl e ${Apache_LOG_DIR} is not defined
[Tue Jan 08 12:05:13.514596 2019] [core:warn] [pid 6361] AH00111: Config variabl e ${Apache_RUN_DIR} is not defined
[Tue Jan 08 12:05:13.515068 2019] [core:warn] [pid 6361] AH00111: Config variabl e ${Apache_LOG_DIR} is not defined
Server MPM: prefork

this リンクが役立つかどうかを確認します。

私は実行しました:Sudo apachectl -tsyntax okを取得しました。 Sudo Apache2 -X -f /etc/Apache2/httpd.confファイルがないため、httpd.confを実行できません。実行すると:service apachectl startFailed to start apachectl.service: Unit apachectl.service not found.

これは私の/etc/Apache2/envvarsです

# envvars - default environment variables for Apache2ctl

# this won't be correct after changing uid
unset HOME

# for supporting multiple Apache2 instances
if [ "${Apache_CONFDIR##/etc/Apache2-}" != "${Apache_CONFDIR}" ] ; then
SUFFIX="-${Apache_CONFDIR##/etc/Apache2-}"
else
SUFFIX=
fi

# Since there is no sane way to get the parsed Apache2 config in     scripts, some
# settings are defined via environment variables and then used in Apache2ctl,
# /etc/init.d/Apache2, /etc/logrotate.d/Apache2, etc.
export Apache_RUN_USER=www-data
export Apache_RUN_GROUP=www-data
# temporary state file location. This might be changed to /run in Wheezy 1
export Apache_PID_FILE=/var/run/Apache2$SUFFIX/Apache2.pid
export Apache_RUN_DIR=/var/run/Apache2$SUFFIX
export Apache_LOCK_DIR=/var/lock/Apache2$SUFFIX
# Only /var/log/Apache2 is handled by /etc/logrotate.d/Apache2.
export Apache_LOG_DIR=/var/log/Apache2$SUFFIX

## The locale used by some modules like mod_dav
export LANG=C
## Uncomment the following line to use the system default locale instead:
#. /etc/default/locale

export LANG

## The command to get the status for 'Apache2ctl status'.
## Some packages providing 'www-browser' need '--dump' instead of '-dump'.
#export Apache_LYNX='www-browser -dump'

## If you need a higher file descriptor limit, uncomment and adjust the
## following line (default is 8192):
#Apache_ULIMIT_MAX_FILES='ulimit -n 65536'

## If you would like to pass arguments to the web server, add them     below
## to the Apache_ARGUMENTS environment.
#export Apache_ARGUMENTS=''

## Enable the debug mode for maintainer scripts.
## This will produce a verbose output on package installations of web     server modules and web application
## installations which interact with Apache
#export Apache2_MAINTSCRIPT_DEBUG=1

再び私のウェブサイトにアクセスする方法についての助けがあれば、大歓迎です。 WinSCPとPuTTYの両方からSSHアクセスできます。

1
newcat1000

18.04にアップグレードすると、PHP=モジュールが無効になります。私にとっては、これらのコマンドを実行することで修正されました:

Sudo a2enmod php7.2
systemctl restart Apache2
1
arnoldbird