小编sum*_*tix的帖子

使用 nginx 为特定用户代理提供不同的文件

使用nginx,如何为不同的用户代理提供不同的静态文件?例如,如果当前用户正在使用 iPhone,则应为他们提供服务mobile_index.html,而应为所有其他用户代理提供服务browser_index.html

找到解决方案:

server {
  listen 80;
  root /var/www;

  set $mobile_request '0';
  if ($http_user_agent ~ 'iPhone') {
    set $mobile_request '1';
  }

  location =/ {
    if ($mobile_request = '1') {
      rewrite ^ /mobile_index.html;
    }
    if ($mobile_request = '0') {
      rewrite ^ /browser_index.html;
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

http nginx mobile-devices static-files useragent

7
推荐指数
1
解决办法
4150
查看次数

同步两个文件夹的最简单方法

将 Mac OSX 机器上的文件夹内容与 Linux 服务器上的另一个文件夹同步的最简单方法是什么?

您可以使用scp

scp -r /path/to/folder/ username@IP_ADDRESS:/path/to/sync/with
Run Code Online (Sandbox Code Playgroud)

但是scp速度很慢并且会复制所有文件,无论它们是否存在于服务器上。还有哪些其他选择?

linux mac ssh synchronization rsync

3
推荐指数
1
解决办法
1万
查看次数