尊龙凯时人生就是搏

¶à°æ±¾¹²´æ£ºCentOSÉÏͬʱ´î½¨¶à¸öwebЧÀÍÆ÷µÄÖ¸ÄÏ

¶à°æ±¾¹²´æ£ºCentOSÉÏͬʱ´î½¨¶à¸öwebЧÀÍÆ÷µÄÖ¸ÄÏ

ÔÚÏÖ´úµÄweb¿ª·¢ÖУ¬¾­³£ÐèÒªÔÚͳһ̨ЧÀÍÆ÷Éϴ¶à¸öwebЧÀÍÆ÷£¬ÒÔÖª×ã²î±ðÏîÄ¿»ò²î±ð°æ±¾µÄÐèÇó¡£±¾ÎĽ«Ö¸µ¼ÄúÔõÑùÔÚCentOS²Ù×÷ϵͳÉÏʵÏÖ¶à°æ±¾webЧÀÍÆ÷µÄͬʱ´î½¨¡£

Ê×ÏÈ£¬ÎÒÃÇÐèҪװÖúÍÉèÖÃApacheºÍNginxÁ½¸öÖ÷Á÷µÄwebЧÀÍÆ÷¡£ÒÔÏÂÊÇÔÚCentOSÉÏ×°ÖÃApacheºÍNginxµÄ°ì·¨£º

×°ÖÃApache

ʹÓÃÒÔÏÂÏÂÁî×°ÖÃApache£º

sudo yum install httpd

µÇ¼ºó¸´ÖÆ

×°ÖÃÍê³Éºó£¬Æô¶¯Apache²¢½«ÆäÉèÖÃΪ¿ª»ú×ÔÆô¶¯£º

sudo systemctl start httpd
sudo systemctl enable httpd

µÇ¼ºó¸´ÖÆ

×°ÖÃNginx

ʹÓÃÒÔÏÂÏÂÁî×°ÖÃNginx£º

sudo yum install nginx

µÇ¼ºó¸´ÖÆ

×°ÖÃÍê³Éºó£¬Í¬ÑùÆô¶¯Nginx²¢ÉèÖÃΪ¿ª»ú×ÔÆô¶¯£º

sudo systemctl start nginx
sudo systemctl enable nginx

µÇ¼ºó¸´ÖÆ

ÖÁ´Ë£¬ÎÒÃÇÒÑÍê³ÉÁËApacheºÍNginxµÄ×°ÖúÍÉèÖ᣽ÓÏÂÀ´£¬ÎÒÃǽ«ÉèÖöà¸ö°æ±¾µÄwebЧÀÍÆ÷¡£

ÉèÖÃApacheµÄ¶à°æ±¾

Ê×ÏÈ£¬ÎÒÃÇÐèҪΪÿ¸ö²î±ð°æ±¾µÄwebЧÀÍÆ÷½¨Éè²î±ðµÄÐéÄâÖ÷»ú¡£ÔÚApacheÖУ¬ÐéÄâÖ÷»úµÄÉèÖÃÎļþλÓÚ/etc/httpd/conf.dĿ¼Ï¡£ÎÒÃÇ¿ÉÒÔΪÿ¸ö°æ±¾½¨ÉèÒ»¸öÏìÓ¦µÄÉèÖÃÎļþ£¬ÀýÈ磬ÎÒÃǽ¨ÉèÁ½¸ö°æ±¾µÄÐéÄâÖ÷»ú£¬»®·ÖÊÇvhost1.confºÍvhost2.conf¡£

½¨Éèvhost1.conf£º

sudo vi /etc/httpd/conf.d/vhost1.conf

µÇ¼ºó¸´ÖÆ

½«ÒÔÏÂÄÚÈÝÌí¼Óµ½vhost1.confÎļþÖУº

<VirtualHost *:80>
    ServerAdmin admin@vhost1.com
    DocumentRoot /var/www/vhost1
    ServerName vhost1.com
    <Directory /var/www/vhost1>
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

µÇ¼ºó¸´ÖÆ

½¨Éèvhost2.conf£º

sudo vi /etc/httpd/conf.d/vhost2.conf

µÇ¼ºó¸´ÖÆ

½«ÒÔÏÂÄÚÈÝÌí¼Óµ½vhost2.confÎļþÖУº

<VirtualHost *:80>
    ServerAdmin admin@vhost2.com
    DocumentRoot /var/www/vhost2
    ServerName vhost2.com
    <Directory /var/www/vhost2>
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

µÇ¼ºó¸´ÖÆ

ÉúÑIJ¢Í˳öÉèÖÃÎļþ¡£½ÓÏÂÀ´£¬ÎÒÃÇÐèÒª½¨ÉèÏìÓ¦µÄÍøվĿ¼²¢ÉèÖÃȨÏÞ£º

sudo mkdir /var/www/vhost1
sudo chmod -R 755 /var/www/vhost1

sudo mkdir /var/www/vhost2
sudo chmod -R 755 /var/www/vhost2

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

ÖØÆôApacheʹÉèÖÃÉúЧ£º

sudo systemctl restart httpd

µÇ¼ºó¸´ÖÆ

ÉèÖÃNginxµÄ¶à°æ±¾

ͬÑù£¬ÔÚNginxÖУ¬ÎÒÃÇÒ²ÐèҪΪÿ¸ö°æ±¾½¨Éè²î±ðµÄÉèÖÃÎļþ¡£NginxµÄÉèÖÃÎļþλÓÚ/etc/nginx/conf.dĿ¼Ï¡£

½¨Éèvhost1.conf£º

sudo vi /etc/nginx/conf.d/vhost1.conf

µÇ¼ºó¸´ÖÆ

½«ÒÔÏÂÄÚÈÝÌí¼Óµ½vhost1.confÎļþÖУº

server {
    listen 80;
    server_name vhost1.com;
    root /var/www/vhost1;
    index index.html index.htm;
    location / {
        try_files $uri $uri/ =404;
    }
}

µÇ¼ºó¸´ÖÆ

½¨Éèvhost2.conf£º

sudo vi /etc/nginx/conf.d/vhost2.conf

µÇ¼ºó¸´ÖÆ

½«ÒÔÏÂÄÚÈÝÌí¼Óµ½vhost2.confÎļþÖУº

server {
    listen 80;
    server_name vhost2.com;
    root /var/www/vhost2;
    index index.html index.htm;
    location / {
        try_files $uri $uri/ =404;
    }
}

µÇ¼ºó¸´ÖÆ

ÉúÑIJ¢Í˳öÉèÖÃÎļþ¡£½ÓÏÂÀ´£¬ÎÒÃÇÐèÒª½¨ÉèÏìÓ¦µÄÍøվĿ¼²¢ÉèÖÃȨÏÞ£º

sudo mkdir /var/www/vhost1
sudo chmod -R 755 /var/www/vhost1

sudo mkdir /var/www/vhost2
sudo chmod -R 755 /var/www/vhost2

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

ÖØÆôNginxʹÉèÖÃÉúЧ£º

sudo systemctl restart nginx

µÇ¼ºó¸´ÖÆ

ÖÁ´Ë£¬ÎÒÃÇÒÑÀÖ³ÉÉèÖÃÁËApacheºÍNginxµÄ¶à°æ±¾webЧÀÍÆ÷¡£Äú¿ÉÒÔƾ֤ÐèÒªÌí¼Ó¸ü¶àµÄÐéÄâÖ÷»úºÍÉèÖÃÎļþ¡£

×ܽ᣺

±¾ÎÄÏÈÈÝÁËÔõÑùÔÚCentOS²Ù×÷ϵͳÉÏ×°ÖúÍÉèÖÃApacheºÍNginx£¬²¢Í¨¹ý½¨ÉèÐéÄâÖ÷»úºÍÉèÖÃÎļþʵÏÖ¶à°æ±¾webЧÀÍÆ÷µÄͬʱ´î½¨¡£Ê¹Óöà°æ±¾webЧÀÍÆ÷£¬Äú¿ÉÒÔÀû±ãµØÖª×ã²î±ðÏîÄ¿»ò²î±ð°æ±¾µÄÐèÇó¡£×£ÄúÔÚweb¿ª·¢ÖÐÈ¡µÃÀֳɣ¡

ÒÔÉϾÍÊǶà°æ±¾¹²´æ£ºCentOSÉÏͬʱ´î½¨¶à¸öwebЧÀÍÆ÷µÄÖ¸ÄϵÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是搏ÂËÓÍ»úÍø¹Ù·½Á¢³¡£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是搏ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是搏

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ