我按照这个过程在我的 Ubuntu 10.04 Lucid 服务器上安装了 nginx http://library.linode.com/web-servers/nginx/installation/ubuntu-10.04-lucid
在创建 init 脚本以启动 nginx,然后调用 /etc/init.d/nginx start 之后,我迷路了。当我这样做时,我收到以下错误:
Starting nginx_main: Starting /opt/nginx/sbin/nginx...
nginx: [alert] could not open error log file: open() "/opt/nginx/logs/error.log" failed (13: Permission denied)
2012/03/16 18:17:27 [emerg] 859#0: open() "/opt/nginx/logs/access.log" failed (13: Permission denied)
Run Code Online (Sandbox Code Playgroud)
我可以运行它的唯一方法是,如果我使用sudo
它并且它将进程作为 运行root
,这是我不想要的。
我已经创建chown
了整个目录 ( chown -R nginx:nginx /opt/nginx
) 并且我也拥有chmod -R 755
了该目录。
user
按照 CS3 的建议添加指令也会给我这个错误,但还有一行。
Starting nginx_main: Starting /opt/nginx/sbin/nginx...
nginx: [alert] could not open error log file: open() "/opt/nginx/logs/error.log" …
Run Code Online (Sandbox Code Playgroud) 标题基本概括了所有内容。基本上,我想根据请求的源 IP 将请求路由到特定的后端服务器。
IE,
HTTP Request from 192.168.100.1 -> HAProxy -> BackendServer A
HTTP Request from 192.168.100.2 -> HAProxy -> BackendServer B
Run Code Online (Sandbox Code Playgroud) 我想将我的 postgresdata
文件夹移动到 NFS 驱动器,但我不确定什么是最好的方法。我想到了三个选择:
根据Postgres Documentation,一种方法是使用initdb
带有-D
选项的命令。
initdb
如果您指定的目录不存在,则将尝试创建该目录。
LinuxQuestions.org上列出的另一种方法是更新postgressql
init 脚本以指向新目录,在本例中为 NFS 驱动器。
最后,我想我只是将pgsql/data
文件夹复制到 NFS 驱动器,然后简单地对文件夹进行符号链接。
IE, pgsql/data -> nfs/data
符号链接或更新 init 脚本对我来说似乎是最简单的方法,但我不确定它们是最好还是最安全的方法。这是我希望有人可以帮助我的地方。任何建议、顾虑和优点/缺点将不胜感激。
环境信息
假设 NFS 驱动器是使用-maproot=root
选项安装的,并且root
用户可以访问 NFS 驱动器。
haproxy ×1
init.d ×1
migration ×1
nfs ×1
permissions ×1
postgresql ×1
routing ×1
ubuntu ×1
ubuntu-10.04 ×1