【问题标题】:First time running a ubuntu server is it possible I have nginx installed in two places?第一次运行 ubuntu 服务器是否可以在两个地方安装 nginx?
【发布时间】:2012-02-09 17:03:07
【问题描述】:

我有两条路:

/etc/nginx/sites-enabled /opt/nginx/conf/nginx.conf

两者都包含一个 .conf 文件,我可以在两个位置安装 nginx 吗?当我编辑第一个 /etc/ conf 文件时,我可以控制提供的内容,似乎 /opt conf 文件被忽略了。为什么?

配置 1:

server {
    listen 80;
    server_name www.mydomain.com;
    access_log  /var/www/mydomain/logs/access.log;

    root /var/www/mydomain/;
    index me.html me.js;
}
~   

conf 2(在 /opt/nginx/conf/nginx.conf 中忽略

events {
    worker_connections  1024;
}


http {
    passenger_root /usr/local/rvm/gems/ruby-1.9.3-p0/gems/passenger-3.0.11;
    passenger_ruby /usr/local/rvm/wrappers/ruby-1.9.3-p0/ruby;

    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;
    server {
        listen       80;
        server_name  www.mydomain.com;
        root         /var/www/hello/releases/current/public/;
        passenger_enabled on;
       }
    server {
        listen       80;
        server_name  localhost;

【问题讨论】:

    标签: nginx


    【解决方案1】:

    不,您只有一个安装。

    /opt/local/nginx/conf 是 nginx 服务器的基本配置所在的位置。

    /etc/nginx/sites-enabled 是您想要激活的符号链接站点(来自 /etc/nginx/sites-available。。 p>

    /etc/nginx/sites-available 应包含虚拟主机的各个 conf 文件。

    sites-available 文件夹中应该有一个文件(如果您没有再添加的话)。那将是正在使用的那个。它可能不是以.conf 结尾的命名

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-04-13
      • 1970-01-01
      • 2021-09-24
      • 2011-01-04
      • 2014-09-26
      • 1970-01-01
      • 2023-02-07
      • 1970-01-01
      相关资源
      最近更新 更多