๐Ÿฉน ์•„ํ”„๋‹ค ์•„ํŒŒ์น˜(Apache)

์ •์€๊ฒฝยท2020๋…„ 7์›” 22์ผ
0

๐Ÿ‘ธ Front-End Queen

๋ชฉ๋ก ๋ณด๊ธฐ
25/278
post-thumbnail

์•„ํŒŒ์น˜์— ๋ฆฌ์•กํŠธ ๋ฐฐํฌํ•˜๊ธฐ
์•„ํ”„๋‹ค๐Ÿ˜ฅ
์•„ํŒŒ์•„ํŒŒ ์•„ํŒŒ์น˜..............

Apache

์•„ํŒŒ์น˜์— ๋ฐฐํฌ ์„ฑ๊ณต!
์ƒ๊ฐ๋ณด๋‹ค ๊ฐ„๋‹จํ•ด์„œ
ํ•ด๊ฒฐํ•˜๊ณ ๋‚œ๋’ค ํ—ˆ๋ฌดํ•จ์ด๋ž€...!
๊ฒฐ๋ก ์ ์œผ๋กœ ๋„์›€์ด ๋˜์—ˆ๋˜ ์•„ํ‹ฐํด์€ ์•„๋ž˜์˜ ๋งํฌ!
https://blog.learningdollars.com/2020/01/16/how-to-host-a-django-api-using-mod-wsgi-serving-a-react-frontend-on-an-apache-server-on/

  1. ์•„ํŒŒ์น˜ ์„œ๋ฒ„์— npm ์„ค์น˜
  2. ์•„ํŒŒ์น˜ ์„œ๋ฒ„์—์„œ ๋ฆฌ์•กํŠธ ๋ ˆํฌ์ง€ํ† ๋ฆฌ ํด๋ก ๋ฐ›๊ธฐ
  3. ํด๋ก ๋ฐ›์€ ๋ฆฌ์•กํŠธ ํ”„๋กœ์ ํŠธ์—์„œ ๋นŒ๋“œ ์‹คํ–‰
    ๋นŒ๋“œํ• ๋•Œ ์ฃผ์˜์ !
    package.json์— homepage ์„ค์ •ํ•ด์ค˜์•ผ ์ข‹์•„์—ผ! (์ƒ๋Œ€๊ฒฝ๋กœ๋กœ!)
  4. ๋นŒ๋“œ ๊ฒฐ๊ณผ ์‹คํ–‰๋œ ํŒŒ์ผ์„ ์•„๋ž˜์™€ ๊ฐ™์ด /var/www/html/๋กœ ์˜ฎ๊ฒจ์ค€๋‹น!
sudo cp -r ~/ldeproject/reactapache/apachereactapp/build/* /var/www/html/
  1. /var/www/html/ ๋””๋ ‰ํ„ฐ๋ฆฌ ์•ˆ์— ".htaccess"ํŒŒ์ผ์„ ๋งŒ๋“ค์–ด์ค˜์•ผํ•ฉ๋‹ˆ๋‹น. ๋‚ด์šฉ์€ ์•„๋ž˜์™€ ๊ฐ™์ด!
Options -MultiViews 
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L]![]
  1. ์•„ํŒŒ์น˜ ์„œ๋ฒ„ ์žฌ์‹คํ–‰
sudo a2enmod rewrite
sudo systemctl restart apache2

Reference

profile
#์˜์‹์˜ํ๋ฆ„ #์ˆœ๊ฐ„์ˆœ๊ฐ„ #์ƒ๊ฐ์˜์Šค๋ƒ…์ƒท

0๊ฐœ์˜ ๋Œ“๊ธ€