小编Iva*_*chi的帖子

更改 nginx 中的 localhost 主机名

我有多个本地站点,我想将 nginx 配置为每个网站都有不同的主机。

在 /var/www 中我有 2 个站点:site1 和 site2

然后在 /etc/nginx/sites-available/ 中,我为每一个创建了 2 个不同的配置服务器。我有文件 site1 和 site2 ,其内容如下:

server {
        listen 80;

        root /var/www/site1;
        index index.html index.htm;

        server_name localhost;

        location / {
                try_files $uri $uri/ /index.html;
        }
}
Run Code Online (Sandbox Code Playgroud)

server {
            listen 7777;

            root /var/www/site2;
            index index.html index.htm;

            server_name localhost;

            location / {
                    try_files $uri $uri/ /index.html;
            }
    }
Run Code Online (Sandbox Code Playgroud)

http://localhost:80我通过for site1 和for site2访问它们http://localhost:7777。效果很好。我还可以在 /etc/hosts 中添加主机名,如下所示:

127.0.0.1 localhost site1 site2
Run Code Online (Sandbox Code Playgroud)

我可以使用http://site1:80和访问它们http://site2:7777。但我必须始终访问端口号。我想通过http://site1和访问它们 …

nginx

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

如何更改过滤器内的$ scope变量

我需要更改$scope过滤器内的变量.该$scope变量用于ng-show属性,并且信息仅在过滤器中加入,因为我有ng-repeat一些信息并由一些过滤器应用,我需要知道过滤器何时删除所有结果以显示消息...这里是一个例如:(这只是一个想法)

.controller("thing", function() {
   $scope.showText = false;
})

.filter("filterText", function() {
   return function(information) {
     if (information == "") { /* NEED TO CHANGE $scope.showText to true */ }
   }
})
Run Code Online (Sandbox Code Playgroud)

HTML:

<div ng-view="showText"> Some Text here </div>
<div ng-repeat="info in information | filterText"></div>
Run Code Online (Sandbox Code Playgroud)

谢谢.

angularjs

6
推荐指数
1
解决办法
5356
查看次数

如何从angularJS中过滤的数组中获取实际值

我的问题是我需要知道我的数组过滤后是否为空.我正在将一些过滤器应用于数组并显示结果,当过滤器没有结果时,我需要显示一条消息错误.如何捕获数组为空的时刻?

HTML:

<div ng-repeat="array in arrays | filterArray1 | filterArray2 | filterArray3 | filter: 'name'>
Run Code Online (Sandbox Code Playgroud)

提前致谢.

angularjs

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

标签 统计

angularjs ×2

nginx ×1