尊龙凯时人生就是搏

NginxÖض¨ÏòÉèÖÃÊÃ÷ÈÕ½£¬ÊµÏÖÍøÕ¾Á÷Á¿×ªÒÆ

nginxÖض¨ÏòÉèÖÃÊÃ÷ÈÕ½£¬ÊµÏÖÍøÕ¾Á÷Á¿×ªÒÆ

½üÄêÀ´£¬Ëæ×Å»¥ÁªÍøµÄѸÃÍÉú³¤£¬ÍøÕ¾Á÷Á¿×ªÒƱäµÃÔ½À´Ô½³£¼û¡£µ±ÎÒÃÇÐèÒª½«Ò»¸öÍøÕ¾µÄÁ÷Á¿Öض¨Ïòµ½ÁíÒ»¸öÍøվʱ£¬NginxµÄÖض¨ÏòÉèÖÃÄܹ»ºÜºÃµØÖª×ãÎÒÃǵÄÐèÇó¡£±¾ÎĽ«´ÓÊÃ÷ÈÕ½½Ç¶È³ö·¢£¬ÏÈÈÝÔõÑùʹÓÃNginxµÄÖض¨ÏòÉèÖÃʵÏÖÍøÕ¾Á÷Á¿×ªÒƵÄÒªÁ죬²¢Ìṩ´úÂëʾÀý¡£

µ±ÎÒÃÇÐèÒª½«Ò»¸ö¾ÉÍøÕ¾µÄÁ÷Á¿×ªÒƵ½Ò»¸öÐÂÍøվʱ£¬¿ÉÒÔͨ¹ýNginxµÄÖض¨ÏòÉèÖÃÀ´ÊµÏÖÕâһĿµÄ¡£ÏÂÃæÊÇÒ»¸ö»ù±¾µÄNginxÖض¨ÏòÉèÖÃʾÀý£¬ÔÚÉèÖÃÎļþÖÐÌí¼ÓÒÔÏÂÄÚÈÝ£º

server {
  listen 80;
  server_name oldsite.com;
  return 301 http://newsite.com$request_uri;
}

µÇ¼ºó¸´ÖÆ

ÒÔÉÏÉèÖý«»á½«ËùÓÐÀ´×Ôoldsite.comµÄÁ÷Á¿Öض¨Ïòµ½newsite.com¡£ÆäÖУ¬return 301ÌåÏÖÖ´ÐÐ301Öض¨Ïò£¬http://newsite.com$request_uriÌåÏÖÖض¨Ïòµ½http://newsite.com²¢±£´æԭʼÇëÇóµÄURI¡£

³ýÁË»ù±¾µÄÖض¨ÏòÉèÖã¬Nginx»¹ÌṩÁ˸ü¶à¸ß¼¶µÄÖض¨ÏòÉèÖÃÑ¡Ïî¡£ÀýÈ磬ÎÒÃÇ¿ÉÒÔʹÓÃÕýÔò±í´ïʽÀ´ÊµÏÖ¸üÖØ´óµÄÖض¨Ïò¹æÔò¡£ÏÂÃæÊÇÒ»¸öʹÓÃÕýÔò±í´ïʽµÄÖض¨ÏòÉèÖÃʾÀý£º

server {
  listen 80;
  server_name oldsite.com;
  rewrite ^/(.*)$ http://newsite.com/$1 permanent;
}

µÇ¼ºó¸´ÖÆ

ÒÔÉÏÉèÖý«»áδÀ´×Ôoldsite.comµÄËùÓÐÁ÷Á¿Öض¨Ïòµ½newsite.com£¬²¢±£´æԭʼÇëÇóµÄURI¡£

³ýÁËÕë¶ÔÕû¸öÍøÕ¾µÄÁ÷Á¿Öض¨Ïò£¬ÎÒÃÇ»¹¿ÉÒÔÕë¶ÔÌض¨µÄURL¾ÙÐÐÖض¨Ïò¡£ÀýÈ磬ÎÒÃÇ¿ÉÒÔ½«oldsite.com/aboutÒ³ÃæµÄÁ÷Á¿Öض¨Ïòµ½newsite.com/aboutÒ³Ãæ¡£ÏÂÃæÊÇÒ»¸öÕë¶ÔÌض¨URLµÄÖض¨ÏòÉèÖÃʾÀý£º

location /about {
  rewrite ^ http://newsite.com/about permanent;
}

µÇ¼ºó¸´ÖÆ

ÒÔÉÏÉèÖý«»áδÀ´×Ôoldsite.com/aboutÒ³ÃæµÄÁ÷Á¿Öض¨Ïòµ½newsite.com/aboutÒ³Ãæ¡£

³ýÁËÉÏÊöµÄ»ù±¾Ó÷¨£¬Nginx»¹ÌṩÁ˸ü¶à¸ß¼¶µÄÖض¨ÏòÉèÖÃÑ¡ÏÀýÈçÖض¨Ïòµ½Ö¸¶¨URLµÄÖ¸¶¨Î»ÖᢴøÓÐÕýÔò±í´ïʽµÄ¸ß¼¶Æ¥ÅäµÈ¡£ÕâЩѡÏî¿ÉÒÔÈÃÎÒÃÇÔ½·¢ÎÞаµØÉèÖÃÁ÷Á¿Öض¨Ïò¹æÔò¡£

ÐèҪעÖصÄÊÇ£¬µ±ÎÒÃÇÉèÖÃÁËÖض¨Ïò¹æÔòʱ£¬Ó¦µ±ÉóÉ÷µØ²âÊÔºÍÑéÖ¤ÕâЩ¹æÔòÊÇ·ñƾ֤ԤÆÚÊÂÇé¡£ÔÚÉèÖÃÎļþÖÐÌí¼ÓÒ»ÌõÖض¨Ïò¹æÔòʱ£¬Ó¦µ±ÖØмÓÔØNginxÉèÖÃÎļþÒÔʹÉèÖÃÉúЧ£º

sudo nginx -s reload

µÇ¼ºó¸´ÖÆ

ÔÚʹÓÃNginxµÄÖض¨ÏòÉèÖþÙÐÐÍøÕ¾Á÷Á¿×ªÒÆʱ£¬ÎÒÃÇ¿ÉÒÔƾ֤ÏÖʵÐèÇóÑ¡ÔñÊʺϵÄÖض¨Ïò¹æÔò£¬²¢Í¨¹ý²âÊÔÈ·±£¹æÔòµÄ׼ȷÐÔ¡£±ðµÄ£¬Ó¦µ±¼á³ÖNginxµÄ°æ±¾Óë×îеÄÎȹ̰汾¼á³ÖÒ»Ö£¬ÒÔ×èÖ¹·ºÆðÒÑÖªµÄÎó²îºÍÇå¾²ÎÊÌâ¡£

×ܽáÆðÀ´£¬NginxµÄÖض¨ÏòÉèÖÃÄܹ»ºÜºÃµØʵÏÖÍøÕ¾Á÷Á¿×ªÒÆ¡£Í¨¹ýºÏÀíÉèÖÃÖض¨Ïò¹æÔò£¬ÎÒÃÇ¿ÉÒÔ½«Ò»¸öÍøÕ¾µÄÁ÷Á¿ÓÐÑ¡ÔñµØÖض¨Ïòµ½ÁíÒ»¸öÍøÕ¾£¬ÊµÏÖÁ÷Á¿µÄתÒƺÍÌøת¡£Í¨¹ý±¾ÎÄÌṩµÄʾÀý´úÂëºÍÊÃ÷ÈÕ½ÂÄÀú£¬¶ÁÕß¿ÉÒÔ¸üºÃµØÃ÷È·ºÍÔËÓÃNginxµÄÖض¨Ïò¹¦Ð§¡£

ÒÔÉϾÍÊÇNginxÖض¨ÏòÉèÖÃÊÃ÷ÈÕ½£¬ÊµÏÖÍøÕ¾Á÷Á¿×ªÒƵÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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