Articles of 别名

为什么我的Nginx别名redirect不起作用(转到404)?

我有我的主要网站在x.com(@ /var/www/x.com/index.html ) # MAIN LOCATION location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; #autoindex on; proxy_set_header X-Real-IP $remote_addr; } 我想/ v2redirect到另一个本地目录(@ /var/www/x.com/v2/public/index.html ) # Redirect beta site location /v2 { alias /var/www/x.com/v2/public; } 这似乎应该工作,但相反,它是去我的404网站。 不知道这是否重要,但这里是我的根源: # […]

nginx别名语法

我试图使用下面的语法别名在网站中的一些照片的位置: location ~/^apple-touch-icon(.*)\.png$ { alias /opt/web_alpha/img/$1; } 是正确的,或者我在nginx的access.log中错过了其他的东西我得到这个消息: “GET /apple-touch-icon.png HTTP / 1.1”404 142 但在浏览器中显示索引页面 此外,我很困惑别名和重写在nginx,我应该使用

多个Nginx别名到一个位置

我想为一个位置的两个别名创build一个位置规则。 这是用于一个位置的规则: location ~ ^/images/(.*)$ { alias /var/www2/images/$1; } 我想要做的是定义两个别名的位置。 因此,例如,我可以访问http://domain.com/styles/file.css和http://domain.com/css/file.css ,它会去一个别名是/ var / www2 / styles / 我尝试过这样的事情,但是这对我没有用。 location ~ ^/(styles|css)(.*)$ { alias /var/www2/styles/$1; } 但是再一次,我不知道多less正则expression式。

如何在nginx中正确configurationalias指令?

我一直在尝试在我的nginxnetworking服务器上configuration多个webapp,但我无法使用一个需要将$ document_root设置为laravel公用文件夹的Laravel应用程序。 我目前正在尝试使用别名指令来configuration它,但出于一个晦涩的原因,这是行不通的。 这是我想要做的。 # Default server configuration # server { listen 80; # SSL configuration # listen 443 ssl; error_log /var/log/nginx/error.log warn; ssl_certificate /etc/nginx/ssl/server.crt; ssl_certificate_key /etc/nginx/ssl/server.key; set $root_path '/var/www/html'; root $root_path; # Add index.php to the list if you are using PHP index index.html index.htm index.nginx-debian.html index.php; server_name localhost; location /paperwork { alias /var/www/html/paperwork/frontend/public; […]

Bash cd命令自动完成自定义别名

假设我有一个简单的函数作为cd的别名。 c(){ cd "$@"; } 我怎样才能得到 我的新function 的 cd 工作 的原始自动完成 ? 请注意, cd仅自动完成目录名称,而不是简单的文件名称。 我知道complete命令,但确切的是由cd使用的自动完成function的位置? 感谢帮助!

在当前目录中打开最后一个目录的别名

我想创build别名打开当前目录中的最后一个目录,也许我认为可以使用这个命令获取目录的名称:ls -lt | 头-1但我不说使用它。 用函数或别名解决:alias oo ='cd $(ls -lt | head-1)'

如何查找terminal中执行哪个实际的命令

我有一个名为gb (转换替代构build命令)的命令位于$ {HOME} / App / bin,并在'PATH'中。 当我检查它时: which gb 它返回正确的位置${HOME}/App/bin/gb 我也检查别名 alias | grep gb 它什么都不返回。 但是当我从terminal运行gb命令 $ gb 它总是返回git branch命令的结果。 只是想知道怎么才能找出导致gb命令劫持的原因?

试图做一个永久的别名 – UNIX

我想在unix中build立一个永久的别名( alias homedir='cd /export/home/Files/myName' )。 我正在尝试在〜/ .bashrc文件中添加该命令,但在$ HOME目录中找不到该文件。 唯一的bash文件就是.bash_history,请帮忙。 我甚至做了一个ls -a ,仍然没有find它在我的$ HOME目录。

Bash:cd到程序输出提供的目录

我有一个简短的shell程序返回一个系统path。 我想要做的是使用bash别名的CD到那个path。 我的理想输出是 ~$ pwd /home/username ~$ mark home ~$ cd / /$ pwd / /$ place home ~$ pwd /home/username 我有“标记”部分工作,但“地点”不是: alias place="cd \"~/marker.sh go $@\";" 我的想法是,我想cd到~/marker.sh go $@的输出~/marker.sh go $@ 问题是bash将这个解释为一个命令,并给出错误: -bash: cd: ~/marker.sh go : No such file or directory -bash: home: command not found 我假设这意味着shell将整个别名parsing为一个string。 我已经尝试了别名$(),“等shell脚本部分的各种引用forms,但是他们要么试图在bash start上运行脚本,要么根本不执行,只是保持一个string。 我编程主要是为了学习bash命令,但我无法弄清楚这一部分! 我在iTerm 1.0.0.20130624中运行OSX 10.9,如果这很重要的话。 […]

Linux shell脚本:在函数中使用别名

我使用名为ThousandsDotting的别名添加点. 每3个数字(经典点数千),所以100000成为100.000 。 它在shell中工作正常,但不是在一个函数中 。 示例文件example.sh : #!/bin/bash function test() { echo "100000" | ThousandsDotting } alias ThousandsDotting="perl -pe 's/(\d{1,3})(?=(?:\d{3}){1,5}\b)/\1./g'" test 如果我运行它,这是我得到的: $ ./example.sh example.sh: line 3: ThousandsDotting: command not found. 什么是正确的方式pipe道 (或使用它没有pipe道,无论)标准输出数据到这个perl命令在我的Bash shell脚本的函数?