1

Owncloud 已安装并在我的网络上运行 Nginx。我可以从局域网外部访问我自己的云。我只想在我的局域网上托管一个Lionwiki

我想添加一个新的配置文件以/etc/nginx/sites-enabled/仅在本地网络上为特定目录提供服务。

我目前的配置:

$ cat /etc/nginx/sites-enabled/default 
# owncloud (ssl/tls)
server {
  listen 443 ssl;
  server_name 192.168.1.10;
  ssl_certificate /etc/nginx/cert.pem;
  ssl_certificate_key /etc/nginx/cert.key;
  root /var/www;
  index index.php;
  client_max_body_size 1000M; # set maximum upload size
  fastcgi_buffers 64 4K;

  # deny direct access
  location ~ ^/owncloud/(data|config|\.ht|db_structure\.xml|README) {
    deny all;
  }

  # default try order
  location / {
    try_files $uri $uri/ index.php;
  }

  # owncloud WebDAV
  location @webdav {
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param HTTPS on;
    include fastcgi_params;
  }

  # enable php
  location ~ ^(?<script_name>.+?\.php)(?<path_info>/.*)?$ {
    try_files $script_name = 404;
    include fastcgi_params;
    fastcgi_param PATH_INFO $path_info;
    fastcgi_param HTTPS on;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_read_timeout 900s; # 15 minutes
  }
}    
4

1 回答 1

1

为您的 nginx 设置设置两个“托管包”。一种监听您自己云的公共主机名,另一种监听内部主机名和/或内部 IP。然后您可以通过http://the-host-name-you-have.chosen访问您的 Owncloud,并通过 \SERVERNAME 或您的内部 IP 访问您的 wiki,例如 192.168.0.3

您的配置可能看起来有点像:

server {
            listen       80;
            server_name  SERVERNAME;

            access_log  logs/localhost.access.log  main;

            location / {
                root /var/www/lionwiki;
                index index.html index.htm index.php;
            }

            listen       80;
            server_name  public-host-name;

            access_log  logs/localhost.access.log  main;

            location / {
                root /var/www/owncloud;
                index index.html index.htm index.php;
            }
       }

注意:我不能 100% 确定该语法是否正确,我通常使用 IIS。

于 2014-10-28T15:48:32.120 回答