Warning: include(/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php): failed to open stream: No such file or directory in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24

Warning: include(/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php): failed to open stream: No such file or directory in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24

Warning: include(): Failed opening '/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php' for inclusion (include_path='.:/opt/cpanel/ea-php70/root/usr/share/pear') in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24

Warning: Cannot modify header information - headers already sent by (output started at /home/blog66rr/public_html/wp-content/advanced-cache.php:24) in /home/blog66rr/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1723

Warning: Cannot modify header information - headers already sent by (output started at /home/blog66rr/public_html/wp-content/advanced-cache.php:24) in /home/blog66rr/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1723

Warning: Cannot modify header information - headers already sent by (output started at /home/blog66rr/public_html/wp-content/advanced-cache.php:24) in /home/blog66rr/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1723

Warning: Cannot modify header information - headers already sent by (output started at /home/blog66rr/public_html/wp-content/advanced-cache.php:24) in /home/blog66rr/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1723

Warning: Cannot modify header information - headers already sent by (output started at /home/blog66rr/public_html/wp-content/advanced-cache.php:24) in /home/blog66rr/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1723

Warning: Cannot modify header information - headers already sent by (output started at /home/blog66rr/public_html/wp-content/advanced-cache.php:24) in /home/blog66rr/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1723

Warning: Cannot modify header information - headers already sent by (output started at /home/blog66rr/public_html/wp-content/advanced-cache.php:24) in /home/blog66rr/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1723

Warning: Cannot modify header information - headers already sent by (output started at /home/blog66rr/public_html/wp-content/advanced-cache.php:24) in /home/blog66rr/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1723
{"id":3195,"date":"2016-04-11T15:50:55","date_gmt":"2016-04-11T07:50:55","guid":{"rendered":"http:\/\/blog.unethost.com\/?p=3195"},"modified":"2016-04-11T15:50:55","modified_gmt":"2016-04-11T07:50:55","slug":"how_to_fix_web_server_visit_real_ip_from_proxy_server","status":"publish","type":"post","link":"https:\/\/blog.unethost.com\/how_to_fix_web_server_visit_real_ip_from_proxy_server\/","title":{"rendered":"\u5982\u4f55\u4fee\u5fa9web server\uff0c\u63a5\u6536proxy server\u50b3\u9001\u4f86\u7684\u771f\u5be6\u8a2a\u5ba2ip?"},"content":{"rendered":"

 <\/p>\n

\"real_ip_nginx_wp\"<\/p>\n

\u4eca\u5929\u9019\u662f\u6bd4\u8f03\u7279\u6b8a\u7684\u60c5\u6cc1\uff0c\u56e0\u70ba\u5206\u6d41\u554f\u984c\uff0c<\/strong>
\nweb\u524d\u7aef\u9084\u6709\u984d\u5916\u67b6\u8a2dproxy server\uff0c\u4f86\u6293\u53d6web server\u7684\u8cc7\u6599\u3002<\/strong><\/p>\n

\u4f46\u662f\u56e0\u70ba\u8a2d\u5b9a\u554f\u984c\uff0c\u5c0e\u81f4web server\uff0c<\/strong>
\n\u53ea\u6703\u6293\u5230proxy server\u672c\u8eab\u7684ip\uff0c<\/strong>
\n\u800c\u4e0d\u662f\u6293\u5230\u8a2a\u5ba2\u7684\u771f\u5be6IP\u3002<\/strong><\/p>\n

<\/p>\n

\u9019\u90e8\u4efd\u7684\u8655\u7406\u6838\u5fc3\u5206\u70ba\u5169\u500b\u968e\u6bb5(\u7279\u5b9a\u898f\u683c)\uff1a<\/span><\/p>\n

    \n
  1. proxy server (nginx)\u7684\u8655\u7406<\/span><\/li>\n
  2. web server (apache)\u7684\u8655\u7406<\/span><\/li>\n<\/ol>\n

    1.<\/span>proxy server\u7684\u90e8\u4efd: \u56e0\u70ba\u662f\u7528nginx\u67b6\u8a2d\uff0c\u5176nginx.conf\uff0c\u6216proxy.conf\uff0c\u6216virtual.conf\uff0c\u5df2\u7d93\u8a2d\u5b9a\u597d\u986f\u793a\u8a2a\u5ba2\u771f\u5be6ip\u7684\u8a9e\u6cd5(\u5982\u672c\u7bc7\u7684\u5c01\u9762\u5716\u7247<\/span>)\uff0c
    \n\u8cc7\u6599\u50b3\u9001\u5230web server\u5f8c\uff0cweb server\u4e5f\u9700\u8981\u6709\u76f8\u5c0d\u61c9\u7684mod\u53bb\u63a5\u6536\uff0c
    \n\u5176mod\u662fmod_rpaf\u3002<\/p>\n

    2.<\/span>web server\u7684\u90e8\u4efd:\u76f4\u63a5\u767b\u5165web server\u5b89\u88ddmod_rpaf (\u4ee5centos\u70ba\u4f8b)\u3002<\/p>\n

    cd \/usr\/local\/src<\/code>
    \nwget http:\/\/mirror.trouble-free.net\/sources\/mod_rpaf-0.6.tar.gz<\/code>
    \ntar -xzf mod_rpaf-0.6.tar.gz<\/code>
    \ncd mod_rpaf-*<\/code>
    \napxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c<\/code><\/p>\n

    \u63a5\u8457\u5728cpanel apache\u88e1\u8a2d\u5b9a\u8f09\u5165mod_rpaf\u53ca\u5176\u53c3\u6578:<\/span><\/p>\n

    LoadModule rpaf_module modules\/mod_rpaf-2.0.so<\/code>
    \nRPAFenable On<\/code>
    \nRPAFproxy_ips 127.0.0.1 \u5728\u589e\u52a0\u4e00\u7d44proxy\u7684ip\u00a0<\/code>
    \nRPAFsethostname On<\/code>
    \nRPAFheader X-Real-IP<\/code><\/p>\n

     <\/p>\n

    \u63a5\u8457\u5728\u91cd\u958bapache\uff0c\u9806\u5229\u7684\u8a71\u5c31\u53ef\u4ee5\u6293\u5230\u8a2a\u5ba2\u771f\u5be6ip\uff0c\u65b9\u4fbf\u505a\u8cfc\u7269\u8a18\u9304\u4e4b\u985e\u7684\u3002<\/p>\n

     <\/p>\n

    (\u672c\u7bc7\u6559\u5b78\u7531unethost.com\u5ba2\u670d\u64b0\u5beb<\/a>)<\/strong><\/span><\/p>\n

    \u5ef6\u4f38\u95b1\u8b80:\u5982\u4f55\u5099\u4efdCpanel\u5f8c\u53f0\u5b89\u88dd\u7684\u5957\u88dd\u7a0b\u5f0f?<\/a><\/strong><\/p>\n

    \u5b89\u88dd\u4e0a\u8ff0\u7684\u8edf\u9ad4\uff0c\u6211\u5011\u63d0\u4f9b\u865b\u64ec\u4e3b\u6a5f\u8a66\u7528\uff0c\u4e03\u5929\u6eff\u610f\u4fdd\u8b49\uff0c<\/span><\/strong>
    \n\u529f\u80fd\u5b8c\u6574\u4f7f\u7528\u4e0d\u53d7\u9650\u5236\uff0c\u6b61\u8fce
    \u9ede\u6211<\/a>\u7533\u8acb\u3002<\/span><\/strong><\/p>\n

     <\/p>\n","protected":false},"excerpt":{"rendered":"

      \u4eca\u5929\u9019\u662f\u6bd4\u8f03\u7279\u6b8a\u7684\u60c5\u6cc1\uff0c\u56e0\u70ba\u5206\u6d41\u554f\u984c\uff0c web\u524d\u7aef\u9084\u6709\u984d\u5916\u67b6\u8a2dproxy server\uff0c\u4f86\u6293\u53d6w … \u95b1\u8b80\u5168\u6587 \u5982\u4f55\u4fee\u5fa9web server\uff0c\u63a5\u6536proxy server\u50b3\u9001\u4f86\u7684\u771f\u5be6\u8a2a\u5ba2ip?<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false},"categories":[151,4],"tags":[47,824,823,825,822,821],"_links":{"self":[{"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/posts\/3195"}],"collection":[{"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/comments?post=3195"}],"version-history":[{"count":2,"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/posts\/3195\/revisions"}],"predecessor-version":[{"id":3203,"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/posts\/3195\/revisions\/3203"}],"wp:attachment":[{"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/media?parent=3195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/categories?post=3195"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/tags?post=3195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}