AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-105312

Cojones's questions

Martin Hope
Cojones
Asked: 2015-05-01 06:34:37 +0800 CST

使用基本身份验证保护 Nginx 上的 Piwik,但允许访问 piwik.js

  • 3

我在我的服务器上运行了 nginx,最近使用以下配置安装了 Piwik:

server {
  listen 443 ssl spdy;
  server_name analytics.example.org;
  root /srv/www/analytics.example.org;
  index index.php;

  ssl_certificate ssl-certificates/wildcard.example.org.crt;
  ssl_certificate_key ssl-certificates/wildcard.example.org.key;

  access_log           /var/log/nginx/analytics.example.org_access.log;
  error_log            /var/log/nginx/analytics.example.org_error.log;

  auth_basic           "HTTP Basic Authentication";
  auth_basic_user_file htpasswd/example;

  satisfy              any;
  include              example_ip;
  deny                 all;

  location ~*  \.(jpg|jpeg|png|gif|ico|css|js)$ {
    expires max;
  }

  location = /robots.txt {
    return 200 "User-agent: *\nDisallow: /\n";
  }

  location / {
    try_files $uri $uri/ /index.php?$args;
  }

  location ~ .php$ {
    try_files $uri $uri/index.php =404;
    include fastcgi.conf;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
  }

  location = /piwik.js {
    satisfy any;
    allow all;
    auth_basic off;
    try_files $uri =404;
  }
}

我正在尝试关闭 /piwik.js 的基本身份验证,因为它是从应用程序本身请求的,并且它总是要求输入用户名和密码。

我在这里做错了什么?

--- 更新 1 ---

更新配置:

...
location = /piwik.js {
  satisfy any;
  allow all;
  auth_basic off;
  try_files $uri =404;
}

location / {
  auth_basic           "Bitte authentifiziere dich.";
  auth_basic_user_file htpasswd/pass;

  satisfy              any;
  include              pass_ip;
  deny                 all;

  try_files $uri $uri/ /index.php?$args;
}
...

现在它让我从应用程序访问 piwik.js 并要求为 analytics.example.org 提供基本身份验证。但是,当我单击取消时,网站的一部分会被加载,下一个基本身份验证、取消、加载等。

--- 更新 2 ---

我还在指令中添加了基本的身份验证内容location ~ .php$,它现在正在工作,但是在两个地方使用它似乎并不正确。无论如何我可以让它变得更好吗?

nginx
  • 1 个回答
  • 551 Views
Martin Hope
Cojones
Asked: 2015-01-28 07:44:24 +0800 CST

服务器更新后无法安装 rmagick

  • 1

我正在运行一个 debian 服务器并在一段时间后升级了所有软件包(apt-get update, apt-get upgrade, apt-get distro-upgrade)。然后 rmagick 不再工作,因为 imagemagick 已更新。

所以我跑了:

gem uninstall rmagick
bundle install

然后我得到了这个:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /usr/local/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... no
Can't install RMagick 0.0.0. Can't find Magick-config in /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/local/bin/ruby

extconf failed, exit code 1

Gem files will remain installed in /srv/www/www.example.com/shared/vendor/bundle/ruby/2.1.0/gems/rmagick-2.13.3 for inspection.
Results logged to /srv/www/www.example.com/shared/vendor/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0-static/rmagick-2.13.3/gem_make.out
An error occurred while installing rmagick (2.13.3), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.13.3'` succeeds before bundling.

这是cat mkmf.log:

    checking for Ruby version >= 1.8.5... -------------------- yes

--------------------

find_executable: checking for gcc... -------------------- yes

--------------------

find_executable: checking for Magick-config... -------------------- no

--------------------

Can't install RMagick 0.0.0. Can't find Magick-config in /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

谁能帮我这个?

--- 更新 1 ---

在安装了一些 graphicsmagic 的东西之后,我得到了一些进一步的信息:

apt-get install graphicsmagick-libmagick-dev-compat
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libmagick++-6-headers libmagick++-6.q16-dev
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  libmagick++-dev libmagickcore-dev
The following NEW packages will be installed:
  graphicsmagick-libmagick-dev-compat
0 upgraded, 1 newly installed, 2 to remove and 1 not upgraded.
Need to get 0 B/26.2 kB of archives.
After this operation, 267 kB disk space will be freed.
Do you want to continue? [Y/n]

这是bundle install输出:

checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... no

Can't install RMagick 0.0.0. Can't find MagickWand.h.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/local/bin/ruby

extconf failed, exit code 1

这对我们有任何帮助吗?

* --- 更新 2 --- *

单独安装后graphicsmagick-libmagick-dev-compat,libmagickcore-dev我尝试安装libmagick++-dev

apt-get install libmagick++-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  graphicsmagick-libmagick-dev-compat
The following NEW packages will be installed:
  libmagick++-dev
0 upgraded, 1 newly installed, 1 to remove and 1 not upgraded.
Need to get 0 B/121 kB of archives.
After this operation, 115 kB of additional disk space will be used.
ruby-on-rails
  • 3 个回答
  • 5956 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve