시놀로지 워드프레스 도메인 설정 (www, /wordpress 없애기)

워드프레스 도메인 ㅠㅠ

워드프레스를 도커에 설치하고 운용하려다가 꼬여서 이틀동안 블로그가 닫혀있었다.
다시 원복하고,
시놀로지와 워드프레스 도메인 설정한 내역을 기록해 둔다.

  1. 도메인 앞에 www 없애기
  2. 워드프레스 설치 안 보이도록

가비아 도메인 설정

가비아 도메인 DNS 설정
가비아 도메인 DNS 설정

A 타입은 삭제하고, CNAME으로만 등록했다.
@, www 모두 vividian.synology.me. 으로 설정 (뒤에 . 잊지 말자)

왜 synology.me DDNS로 설정했나?
기존에는 A타입 실제 집으로 들어오는 회선의 아이피로 연결시켜뒀으나, 고정 아이피가 아닌 까닭에… 아이피가 변경되면 반영하는데 시간이 걸린다.
DDNS로 설정하면, 아이피가 변경되어도 접속이 잘 유지된다.

역방향 프록시

워드프레스와 관련한 역방향 프록시 설정은 모두 삭제했다.

웹스테이션

웹스테이션에 PHP를 설치하면서 무언가 꼬였었다.
PHP 버전 모두 삭제하고, 재부팅하고, PHP 7.4로 다시 설정했다.

웹스테이션 → 웹 서비스 포털 → 기본 서버 → 편집
웹스테이션 → 웹 서비스 포털 → 기본 서버 → 편집
웹스테이션 → 스크립트 언어설정 → 기본 PHP 프로필 설정
웹스테이션 → 스크립트 언어설정 → 기본 PHP 프로필 설정

PHP 프로필 설정에 아래 항목 모두 활성화

  • PHP 캐시 활성화
  • Xdebug 활성화
  • display_errors를 활성화하여 PHP 오류 메시지 표시

PHP 프로필 편집의 확장 메뉴의 모든 기능도 활성화했다.

워드프레스 설치 및 정

워드프레스를 web 밑에 wp로 설치했다.
/web/wp 에 있는 .htaccess 파일과 index.php 파일을 /web 에 복사하고 수정한다.

#BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wp
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L]
</IfModule>

# END WordPress
<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define( 'WP_USE_THEMES', true );

/** Loads the WordPress Environment and Template */
require __DIR__ . '/wp/wp-blog-header.php';


/web/wp 의 .htaccess 파일과 index.php 파일

#BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<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
<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define( 'WP_USE_THEMES', true );

/** Loads the WordPress Environment and Template */
require __DIR__ . '/wp-blog-header.php';


wp-config.php 파일도 수정한다.
다른 것들은 그대로 두고, WP_HOME, WP_SITEURL을 추가한다.
워드프레스 세팅 페이지에서 수정할 수 있겠지만, 수정하는 순간 접속이 안될 것이기 때문에, 편하게 config 파일에서 수정했다.

<?php
/**
 * The base configuration for WordPress
 *
 * The wp-config.php creation script uses this file during the
 * installation. You don't have to use the web site, you can
 * copy this file to "wp-config.php" and fill in the values.
 *
 * This file contains the following configurations:
 *
 * * MySQL settings
 * * Secret keys
 * * Database table prefix
 * * ABSPATH
 *
 * @link https://wordpress.org/support/article/editing-wp-config-php/
 *
 * @package WordPress
 */

define('WP_HOME', 'https://vividian.net');
define('WP_SITEURL', 'https://vividian.net/wp');

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */

...  이하 생략


결론

위와 같이 설정하면,

  • vividian.net/wp 로 접속하지 않고, vividian.net 으로 접속 가능 (.htaccess / index.php 파일 수정했으므로)
  • www.vividian.net 으로 접속할 필요 없이, vividian.net 으로 접속 가능 (wp-config.php 파일 수정했으므로)

댓글 달기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다

Scroll to Top