Linux(CentOS8)에서 Nginx+PHP+Wordpress 설치 #2
- 프로그램 설치후 환경설정을 시작하겠습니다.
1) MariaDB - WordPress용 DB 생성
2) WordPress 환경설정 파일
3) Nginx 환경설정 파일
1) MariaDB - WordPress용 DB 생성
mysql root 암호는 'mysql_secure_installation' 작업때 입력한 암호를 기억하시고 사용하시면 됩니다.
# mysql -u root -p
CREATE DATABASE wordpredb;
CREATE USER `admin`@`localhost` IDENTIFIED BY '암호';
GRANT ALL ON wordpredb.* TO `admin`@`localhost`;
FLUSH PRIVILEGES;
EXIT;
2) WordPress 환경설정 파일
> wp-config.php 파일 생성/수정
# cd /var/www/html/wordpress
- 기존 파일 복사 Copy wp-config-sample.php file to wp-config.php.
# cp wp-config-sample.php wp-config.php
# vi /var/www/html/wordpress/wp-config.php
(환경파일에서 내용을 찾아 수정하시면 됩니다.)
define('DB_NAME', 'wordpredb');
/** MySQL database username */
define('DB_USER', 'admin');
/** MySQL database password */
define('DB_PASSWORD', '암호');
/** This entry will allow you to update, install plugins or themes on WordPress without using FTP **/
define('FS_METHOD', 'direct');
- wordpress 라이센스키를 받아와서 사용합니다.
# curl -s https://api.wordpress.org/secret-key/1.1/salt/
출력된 키를 복사해서 다시 wp-config.php 에 붙여넣기 하여 수정합니다.
define('AUTH_KEY', ';]wL<]6QUL =7|MU$b;01u?;+-U9zHjGs2YwSWiWR@2n3t+lfua-+s^bi[');
define('SECURE_AUTH_KEY', 'G+Y[;~YIn|2V.TIOx_4s2G=0qI|6^}fI|3OBg8Q9~v[]XO!Upg,dl)OHu');
define('LOGGED_IN_KEY', 'h~Jo+S6xF^v_6>#Z [%9>nO]j4uDsaq2y3B+C6nGd~7@s8NPlIR.E,~=3');
define('NONCE_KEY', 'S_5Z?eY~@H: f;|?Q~RFI0p<M}%#V{r~N##M:jw=lxTd6uzl sO31ay-xM');
define('AUTH_SALT', '|`fx},S-Y,i6l]k.F<SiJn4@-2*H<ehs%1{eb-9R|4A 6nZ>3s#-4rMkeD@');
define('SECURE_AUTH_SALT', '-H6f(A^El(hXLSQd*gB&Gq{*wl`o*Xv,N|HMD{-.o6{8p~xTvXE|+$YK|L');
define('LOGGED_IN_SALT', 'axF3sx3X^2(btXk;}A[+z/O2*LV[A?Y++!0r3S_Wk`ryD;irmM/8jbei8Q');
define('NONCE_SALT', '2uk&qo?P|+3$nQjsLs:L<2Xs-g|IT+o~n[[P_]7z>%uT{+lbZ>:o');
서비스 재시작
Restart the PHP-FPM and Nginx services to pick up the recent changes.
# systemctl restart php-fpm nginx
3) Nginx 환경설정 파일
- nginx에 WordPress용 호스트 등록을 위해 환경파일 설정
- 등록한 호스트에 syntax error가 없는지 테스트
- nginx 서비스 재실행
# vi /etc/nginx/conf.d/wordpress.conf
server {
listen 80;
# server_name yourdomain ip_address; "◀ ip_addrss에 서버 ip address 입력"
server_name localhost;
# root /var/www/html/yourdomain;
root /var/www/html/wordpress;
index index.php index.html index.htm;
# set client body size to 100 MB #
client_max_body_size 100M;
location / {
try_files $uri $uri/ /index.php?$args;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/www.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
# nginx -t
# systemctl restart nginx
이제 웹사이트를 접속해서 이상이 없으시면 모두 정상적으로 완료 되었습니다.
> 접속 사이트
http://localhost
http://localhost/wordpress
> 도메인이나 IP 설정하셨다면 입력하시고 테스트 하시면 됩니다.
- 외부에서 접속이 않되신다면 방화벽(firewall-cmd)를 확인해 보세요.
'개발(IT) > Linux(CentOS)' 카테고리의 다른 글
Linux(CentOS8)에서 Nginx+PHP+Wordpress 설치 #1 (0) | 2024.12.28 |
---|---|
CentOS 8에 Oracle 19c DB 생성하기(dbca) (0) | 2023.09.10 |
CentOS 8에 Oracle 19c 설치 하기 #2 (0) | 2023.09.09 |
CentOS 8에 Oracle 19c 설치 하기 #1 (0) | 2023.09.09 |
CentOS 8에 하드디스크(HDD) 추가 (0) | 2023.09.09 |