
이것은 Google이나 제목조차도 어려운 질문입니다.
다음을 사용하여 내 Wordpress 사이트를 성공적으로 방문할 수 있습니다.
그러나 이것은 실패합니다.
이 주소에서 도메인에 접근하려고 하면 상어 사진과 다음 오류가 포함된 파란색 DigitalOcean 브랜드 웹 페이지가 표시됩니다. "LAMP 설치를 구성하려면 SSH를 통해 드롭릿에 로그인하십시오."
Apache 2 및 여러 도메인과 함께 Ubuntu 16.04를 실행하는 DigitalOcean 드롭릿이 있습니다. 도메인 중 하나에 다른 호스트에서 마이그레이션된 Wordpress 사이트가 있습니다. 도메인은 letsencrypt를 통해 설치된 인증서를 포함하여 다른 모든 도메인과 동일하게 구성됩니다.
내 문제가 인증서에 있다고 생각하지 않습니다. 문제는 Wordpress와 관련이 있다고 생각합니다. 내 서버의 다른 사이트는 4가지 조건(http:// 및 https:// 및 www 및 비www)에서 모두 잘 작동하기 때문입니다.
내 (익명화된) .conf 파일은 다음과 같습니다.
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/example>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<IfModule mod_dir.c>
DirectoryIndex index.php index.pl index.cgi index.html index.xh$
</IfModule>
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com [OR]
RewriteCond %{SERVER_NAME} =www.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
여기 /var/www/example 안에 있는 .htaccess 폴더가 있습니다.
# 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]
#test
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
# END WordPress
붙여넣고 익명 처리한 DNS 설정은 다음과 같습니다.
CNAME
ftp.example.com is an alias of example.com.
A
example.com directs to 159.65.36.136
CNAME
www.example.com is an alias of example.com.
NS
example.com directs to ns1.digitalocean.com.
NS
example.com directs to ns2.digitalocean.com.
NS
example.com directs to ns3.digitalocean.com.
여기 apache2ctl -S의 출력이 있습니다.
VirtualHost configuration:
*:443 is a NameVirtualHost
default server othersite1.com (/etc/apache2/sites-enabled/othersite1.com-le-ssl.conf:2)
port 443 namevhost othersite1.com (/etc/apache2/sites-enabled/othersite1.com-le-ssl.conf:2)
alias www.othersite1.com
port 443 namevhost othersite2.co (/etc/apache2/sites-enabled/othersite2.co-le-ssl.conf:2)
alias www.othersite2.co
port 443 namevhost example.com (/etc/apache2/sites-enabled/example.com-le-ssl.conf:2)
alias www.example.com
port 443 namevhost othersite3.com (/etc/apache2/sites-enabled/othersite3.com-le-ssl.conf:2)
alias www.othersite3.com
port 443 namevhost othersite4.com (/etc/apache2/sites-enabled/othersite4.com-le-ssl.conf:2)
alias www.othersite4.com
port 443 namevhost othersite5.net (/etc/apache2/sites-enabled/othersite5.net-le-ssl.conf:2)
alias www.othersite5.net
port 443 namevhost othersite6.com (/etc/apache2/sites-enabled/othersite6.com-le-ssl.conf:2)
alias www.othersite6.com
*:80 is a NameVirtualHost
default server example.com (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost example.com (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost othersite1.com (/etc/apache2/sites-enabled/othersite1.com.conf:1)
alias www.othersite1.com
port 80 namevhost othersite2.co (/etc/apache2/sites-enabled/othersite2.co.conf:1)
alias www.othersite2.co
port 80 namevhost example.com (/etc/apache2/sites-enabled/example.com.conf:1)
alias www.example.com
port 80 namevhost othersite3.com (/etc/apache2/sites-enabled/othersite3.com.conf:1)
alias www.othersite3.com
port 80 namevhost othersite4.com (/etc/apache2/sites-enabled/othersite4.com.conf:1)
alias www.othersite4.com
port 80 namevhost othersite5.net (/etc/apache2/sites-enabled/othersite5.net.conf:1)
alias www.othersite5.net
port 80 namevhost othersite6.com (/etc/apache2/sites-enabled/othersite6.com.conf:1)
alias www.othersite6.com
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33
답변1
가능성 #1
에 대한 기본 VirtualHost처럼 보입니다 *:80
. 구성 파일을 사용하면 출력 상단의 000-default.conf
namevhost와 일치합니다 ... ;example.com
VirtualHost configuration:
default server example.com (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost example.com (/etc/apache2/sites-enabled/000-default.conf:1)
반면에 여기서 일치시키기를 원합니다.
port 80 namevhost example.com (/etc/apache2/sites-enabled/example.com.conf:1)
alias www.example.com
아마도 무슨 일이 일어나고 있는지는 "LAMP 설치를 구성하려면 SSH를 통해 드롭릿에 로그인하십시오."라는 텍스트가 있는 페이지일 것입니다. 의 기본 콘텐츠입니다 /var/www/html
.
그래서 나는 을 제거하고 올바른 VHost /etc/apache2/sites-enabled/000-default.conf
와 일치하는지 확인 하려고 합니다 .example.com
가능성 #2
에서 설정을 확인하세요 wp-config.php
. 리디렉션이 최종적으로 가리키는 것과 일치해야 합니다.
define('WP_HOME','https://example.com');
define('WP_SITEURL','https://example.com');
이로 인해 Apache가 원하는 것과 일치하지 않을 때 WordPress에 문제가 발생하는 경우가 있습니다.
추가 문제 해결
다른 점은 다음과 같은 구성을 붙여넣었다는 것입니다.http://example.com:80/대지;
<VirtualHost *:80>
ServerName example.com
...
</VirtualHost>
그러나 재작성 규칙은 모든 요청을 https://로 반송하는 것처럼 보입니다.
RewriteCond %{SERVER_NAME} =example.com [OR]
RewriteCond %{SERVER_NAME} =www.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
따라서 https 구성도 확인해야 할 것입니다.
또한 실제로 어떤 리디렉션이 발생했는지 확인하려면 하나의 특정 요청과 관련된 access.log 및 error.log의 출력을 붙여넣어야 합니다.
또한 여전히 문제를 확인할 수 없는 경우 다시 쓰기 로깅을 설정할 수 있습니다.
LogLevel alert rewrite:trace3
그런 다음 요청 로그를 추적합니다.
tail -f error_log|fgrep '[rewrite:'