| My Cloud 的UI 后台默认是不支持远程访问的,只能在本地局域网访问。直接在外网访问UI后台会出现 
 ForbiddenYou don't have permission to access /UI on this server.
折腾又开始了
 
 1、先准备好WinSCP和putty
 
 
 2、 用WinSCP编辑 /etc/apache2/sites-available/wdnas-ui.conf;或者用putty,vi /etc/apache2/sites-available/wdnas-ui.conf
 
 <IfModule mod_rewrite.c><Directory "${DOCUMENT_ROOT}/UI">
 #${LOCAL_NET}
 RewriteEngine On
 RewriteBase /UI/
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^(.*)$ /UI/ [R]
 </Directory>
 </IfModule>
用 # 注释掉 ${LOCAL_NET},上面我已经注释过了
 
 3、修改 /var/www/rest-api/api/Common/includes/security.inc,306行,需要修改的地方已经用背景色突出来了http://www.wilf.cn/post/enable-my-cloud-ui-for-remote-access.html
 复制代码/*
 * Returns true if request is from local IP
 */
function isLanRequest() {
 $lanRequest = RequestScope::getInstance()->getLanRequest();
 if(!empty($lanRequest)) {
 return $lanRequest;
 }
 $remoteAddr = $_SERVER['REMOTE_ADDR'];
 \Core\Logger::getInstance()->info('remote addr: ' . $remoteAddr);
 $skipLanCheck = getSkipLanSecurityCheck();
 
 if(strcasecmp($skipLanCheck,"TRUE") == 0) {
 return true;
 }
 if(TRUE || $remoteAddr === '127.0.0.1' || $remoteAddr === 'localhost') {
 RequestScope::getInstance()->setLanRequest(true);
 return true;
 }
 
 4、用 putty 重启 apache,/etc/init.d/apache2 restart
 
 
 UI 后台暴漏给外网,风险较大,请谨慎使用。
 
 
 |