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-863337

current_user's questions

Martin Hope
current_user
Asked: 2019-04-04 21:36:23 +0800 CST

使用 nginx 重定向到“www”前缀域

  • 1

我在 godady 中引入了一个域,并在 Linux/Unix(Ubuntu) 服务器上安装了Passenger + Nginx,并部署了一个 Ruby 应用程序。现在,当我尝试从浏览器请求时,我的域看起来像 http://example.com 。但我希望我的域在每次从浏览器(如http://www.example.com .)请求时默认重定向到www 。

例子.conf

    server {
    listen 80;
    server_name www.example.com example.com;
    # return 301 $scheme://www.example.com$request_uri;
    # Tell Nginx and Passenger where your app's 'public' directory is
    root /var/www/example/public;

    # Turn on Passenger
    passenger_enabled on;
    passenger_spawn_method direct;
    passenger_min_instances 1;
    #passenger_pool_idle_time 0;
    rails_env development;
    passenger_ruby /usr/local/rvm/gems/ruby-2.3.3/wrappers/ruby;
    passenger_sticky_sessions on;


}

取消注释该行

返回 301 $scheme://www.example.com$request_uri;

正在抛出错误

www.example.com redirected you too many times.
Try clearing your cookies.
ERR_TOO_MANY_REDIRECTS

我被迫在浏览器中手动输入www.example.com 。相反,我如何默认重定向到www ?

非常感谢任何帮助。提前致谢!

server dns ruby nginx
  • 2 个回答
  • 481 Views
Martin Hope
current_user
Asked: 2018-10-31 06:02:24 +0800 CST

无法连接到服务器:PostgreSQL 中没有这样的文件或目录

  • 1

我有一个带有 Ubuntu 14.04.5 LTS (GNU/Linux 2.6.32-042stab127.2 x86_64) 的 VPS,并且还安装了 Postgresql。我在 ruby​​ on rails 应用程序中使用 Postgresql。突然我的应用程序停止工作并抛出错误

无法连接到服务器:没有这样的文件或目录服务器是否在本地运行并接受 Unix 域套接字“/var/run/postgresql/.s.PGSQL.5432”上的连接?

    $psql -V 
     psql (PostgreSQL) 11.0 (Ubuntu 11.0-1.pgdg14.04+2)

    $pg_config --version
      PostgreSQL 11.0 (Ubuntu 11.0-1.pgdg14.04+2)

    $postgres -V
     The program 'postgres' is currently not installed. You can install it by typing:
     apt-get install postgres-xc

   $locate bin/postgres
    /usr/lib/postgresql/11/bin/postgres
    /usr/lib/postgresql/9.3/bin/postgres
    /usr/lib/postgresql/9.4/bin/postgres
    /usr/lib/postgresql/9.5/bin/postgres

  $/usr/lib/postgresql/11/bin/postgres -V
    postgres (PostgreSQL) 11.0 (Ubuntu 11.0-1.pgdg14.04+2)

  $pg_lsclusters
  9.3 main    5432 down   postgres /var/lib/postgresql/9.3/main /var/log/postgresql/postgresql-9.3-main.log
  11  main    5433 down   postgres /var/lib/postgresql/11/main  /var/log/postgresql/postgresql-11-main.log

postgres 状态为 down

 $service postgresql status
 9.3/main (port 5432): down
 11/main (port 5433): down

 $systemctl status postgresql.service

  postgresql.service
  Loaded: error (Reason: No such file or directory)
 Active: inactive (dead)

 $systemctl status [email protected]

   [email protected]
   Loaded: error (Reason: No such file or directory)
   Active: inactive (dead)

$grep -H '^port' /etc/postgresql/*/main/postgresql.conf /etc/postgresql/11/main/postgresql.conf:port = 5433
/etc/postgresql/9.3/main/postgresql.conf:port = 5432

我正在尝试启动 Postgresql 9.3

 $service postgresql start 9.3
    * Starting PostgreSQL 9.3 database server                                                                                          
    * Failed to issue method call: Unit [email protected] failed 
     to load: No such file or directory. See system logs and 'systemctl 
     status [email protected]' for details.


  $sudo systemctl start postgresql
   Failed to issue method call: Unit postgresql.service failed to load: No 
   such file or directory. See system logs and 'systemctl status 
    postgresql.service' for details.


   $/etc/init.d# /etc/init.d/postgresql start
    * Starting PostgreSQL 11 database server                                                                                           
    * Failed to issue method call: Unit [email protected] failed to 
    load: No such file or directory. See system logs and 'systemctl status 
    [email protected]' for details.

    [fail]
   * Starting PostgreSQL 9.3 database server                                                                                          
   * Failed to issue method call: Unit [email protected] failed to 
    load: No such file or directory. See system logs and 'systemctl status 
    [email protected]' for details.
    [fail]

我无法启动 PostgreSQL。我不明白它为什么突然宕机,直到昨天它工作正常。

debian postgresql 14.04
  • 2 个回答
  • 10998 Views
Martin Hope
current_user
Asked: 2018-08-24 03:35:50 +0800 CST

sysctl:密钥“fs.inotify.max_user_watches”的权限被拒绝

  • 2

我有一个 Ubuntu 16.04 LTS (GNU/Linux 2.6.32-042stab127.2 x86_64) VPS 在运行我的 rails 应用程序时出现以下错误

致命:监听错误:无法监视目录的更改。访问 https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers 了解如何解决这个问题。

我正在尝试通过将监视限制增加

  $ echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
  $ sudo sysctl -p

它抛出另一个错误

sysctl:密钥“fs.inotify.max_user_watches”的权限被拒绝

我对服务器具有 root 访问权限。

任何增加限制的帮助都非常感谢。提前致谢!

server 16.04 inotify
  • 2 个回答
  • 5084 Views

Sidebar

Stats

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

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

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

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve