μΉμλ²: μννΈ μ¨μ΄λ‘ ν¬λ‘¬μ΄λ μ΅μ€νλ‘λ¬ κ°μ μΉ λΈλΌμ°μ λ‘λΆν° HTTP μμ²μ λ°μλ€μ΄κ³ , HTML λ¬Έμμ κ°μ μΉ νμ΄μ§μμ νν μ°Ύμ λ³Ό μ μλ μλ£ μ»¨ν μΈ μ λ°λΌ HTTP μλ΅μ ν΄μ£Όλ νλ‘κ·Έλ¨
μΉλ£¨νΈν΄λ: μλ²μ μμ μ§μ λλ ν 리
Virtual Host(κ°μ νΈμ€νΈ): μΉ μλ²μ κΈ°λ³Έμ μΌλ‘ μ‘΄μ¬νλ νΈμ€νΈμΈ main hostλ₯Ό μ μΈν λλ¨Έμ§ host
Virtual Hosting: κΈ°λ³Έμ μΌλ‘ μΉμλ²μ μ‘΄μ¬νλ μ£Ό νΈμ€νΈμ λλ©μΈμ λ±λ‘νμ¬ μ¬μ©νκ³ μμ§λ§ μΆκ°μ μΌλ‘ ν μλ²μ μ¬λ¬ λλ©μΈμ λ±λ‘νμ¬ μ¬μ©νλ κ².
1. nginx μ€μ νμΌ κ²μ : sudo locate nginx.conf > νμΌ μ΄κΈ° : sudo vim /etc/nginx/nginx.conf
2. λ°μΌλ‘ λ΄λ¦¬κΈ° > κ²½λ‘ λ³΅μ¬ > :q!(λκ°κΈ°)
3. κ²½λ‘ μ΄λ : cd /etc/nginx/conf.d > νμΌ λ¦¬μ€ν
: ls
4. νμΌ μ΄κΈ° : sudo vim default.conf
5. location > root μ κ²½λ‘ μμ > :wq!(μ μ₯νκ³ λκ°κΈ°)
1. λ€μ€ μλ² μ€μ νμΌ μμ± : sudo vim (νμΌ_μ΄λ¦).conf
2. λ°μ λ΄μ© μΆκ°
server {
listen 8011;
server_name _;
location / {
root /web/site1/public;
}
}
server {
listen 8012;
server_name _;
location / {
root /web/site2/public;
}
}
3. nginx μ¬μμ : sudo systemctl restart nginx
1. /(루νΈ) λ‘ μ΄λ : cd / > ν΄λ μμ± : sudo mkdir -p μ§μ ν_κ²½λ‘ > νμΈ : ls
2. /web μΌλ‘ μ΄λ : cd /web > νμΌ μμ κΆ νμΈ : ls -al
3. μμ κΆ λ³κ²½ : sudo chown κ³μ _μ΄λ¦:κ³μ _μ΄λ¦ -R .
4. κ²½λ‘λ‘ μ§μ ν νμΌ μμ± : cp -r νμΌ_μ΄λ¦ νμΌ_μ΄λ¦
5. νμΈν λ΄μ© μμ± : echo "λ΄μ©" > μ§μ ν_κ²½λ‘
1. VirtualBox > ν¬νΈν¬μλ©
2. μ¬μ΄νΈμ λ€μ΄κ°μ νμΈ : 127.0.0.1:μ€μ ν_ν¬νΈ_λ²νΈ
- systemctl restart μ€λ₯ λ°μ > sudo [νμΌ λ³΅μ¬] | less
- ~~/vhost.conf 17λ² μ§Έ μ€μ μ€λ₯ νμΈ