https://www.youtube.com/watch?v=jqqM607r10M
ubuntu 24.04 LTS 버전의 서버에서
그누보드5를 설치하고 npm 을 설치하여 react 를 같이 사용하는 방법에 대해 알아 봅니다.
sudo apt update
sudo apt install -y apache2 php php-gd php-mysql mysql-server
sudo a2enmod rewrite
mysql 접속후
CREATE DATABASE mydb;
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword';
GRANT ALL PRIVILEGES ON mydb.* TO 'myuser'@'localhost';
FLUSH PRIVILEGES;
exit;
cd /var/www/html
git clone https://github.com/gnuboard/gnuboard5.git
cd gnuboard5
mkdir data
chmod 707 data
웹에서 그누보드5 실행
MySQL 정보입력
User : myuser
Password : mypassword
DB : mydb
sudo apt install -y npm
npx create-react-app react-app
cd react-app
vi package.json
"homepage": "/gnuboard5/react-app",
npm run build
vi .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /gnuboard5/react-app/
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /gnuboard5/react-app/index.html [L]
</IfModule>
vi /etc/apache2/sites-enabled/000-default.conf
Alias /gnuboard5/react-app /var/www/html/gnuboard5/react-app/build
<Directory /var/www/html/gnuboard5/react-app>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
systemctl restart apache2
추가(240827) : .htaccess 는 없어도 되는 것으로 확인했습니다.
댓글 7개
nginx 의 경우 아래 설정을 적용해 보세요.
apt install nginx php-fpm
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html index.php;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
# React 앱을 위한 위치 설정
location /react-app {
alias /var/www/html/gnuboard5/react-app/build;
}
게시글 목록
| 번호 | 제목 |
|---|---|
| 71 | |
| 70 | |
| 69 | |
| 67 | |
| 65 | |
| 59 | |
| 56 | |
| 55 | |
| 54 | |
| 53 | |
| 50 | |
| 47 | |
| 39 | |
| 36 | |
| 34 | |
| 32 | |
| 25 | |
| 24 | |
| 22 | |
| 18 | |
| 17 | |
| 12 | |
| 11 | |
| 5 | |
| 3 | |
| 2 | |
| 1 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기