Я хочу прокси-сервер с моего сервера nginx (у малины pi - он есть свой собственныйcloud) для моего локального apache, у которого также установлен собственный цвет. Проблема в том, что я могу достичь index.php, но загрузки GET для изображений никогда не достигают прокси. pi всегда ищет их у его корня.Прокси-сервер nginx переходит на локальный сервер cms/owncloud
конфигурации Nginx малина
server {
listen 443 ssl; # Make it listen on port 443 for SSL, on both IPv4 and IPv6 interfaces
server_name lexxxel.no-ip.org;
root /var/www/; # Make sure to insert proper path for your ownCloud root directory
index index.php;
client_max_body_size 10G;
# Now we configure SSL certificates. Make sure you enter correct path for your SSL cert files
ssl_certificate /etc/nginx/certs/server.crt;
ssl_certificate_key /etc/nginx/certs/server.key;
fastcgi_buffers 128 4K;
# Configure proper error pages
error_page 403 = /core/templates/403.php;
error_page 404 = /core/templates/404.php;
# Protecting sensitive files from the evil outside world
location ~ ^/(data|config|\.ht|db_structure.xml|README) {
access_log off;
log_not_found off;
deny all;
}
location/{
auth_basic "Please enter your acc and password";
auth_basic_user_file /var/www/.htpasswd;
}
location /manji/ {
auth_basic off;
#proxy_cache_key "$host$request_uri$cookie_user";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_pass https://192.168.178.22/manji/;
#proxy_redirect default;
}
# Configure the root location with proper rewrite rule
location /owncloud/ {
# Some rewrite rules, more to come later
rewrite ^/caldav((/|$).*)$ /remote.php/caldav$1 last;
rewrite ^/carddav((/|$).*)$ /remote.php/carddav$1 last;
rewrite ^/webdav((/|$).*)$ /remote.php/webdav$1 last;
auth_basic off;
rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;
rewrite ^/apps/calendar/caldav.php /remote.php/caldav/ last;
rewrite ^/apps/contacts/carddav.php /remote.php/carddav/ last;
rewrite ^/apps/([^/]*)/(.*\.(css|php))$ /index.php?app=$1&getfile=$2 last;
rewrite ^(/core/doc[^\/]+/)$ $1/index.html;
index index.php; # This one might be redundant, but it doesn't hurt to leave it here
fastcgi_read_timeout 10m;
try_files $uri $uri/ index.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_read_timeout 3600s;
# This one is a little bit tricky, you need to pass all parameters in a single line, separating them with newline (\n)
fastcgi_param PHP_VALUE "upload_max_filesize = 10G \n post_max_size = 10G"; # This finishes the max upload size settings
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # On some systems OC will work without this setting, but it doesn't hurt to leave it here
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
location ~* ^.+.(jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
expires 365d;
access_log off;
fastcgi_read_timeout 10m;
}
location /svn {
access_log off;
proxy_pass https://localhost:444;
}
# location /phpmyadmin {
# access_log off;
# proxy_pass https://localhost:444;
# allow 1.1.1.1;
# #deny all;
# include /etc/nginx/proxy_params;
# location ~* ^.+\.php$ {
# proxy_pass https://localhost:444;
# include /etc/nginx/proxy_params;
# }
# location ~* ^.+.(jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
# proxy_pass https://localhost:444;
# include /etc/nginx/proxy_params;
# }
# }
location ~ ^/home/valerio/(owncloud/)?data {
internal;
root /;
}
location ~ ^/tmp/oc-noclean/.+$ {
internal;
root /;
}
location ~ ^\.(htaccess|htpasswd)$ {
deny all;
}
}
Nginx error.log говорит что-то вроде:
2014/02/09 19:03:38 [error] 24752#0: *289 open() "/var/www404" failed (2: No such file or directory), client: 192.168.178.30, server: 192.168.178.11, request: "GET /manji/owncloud/index.php/apps/files/css/upload.css?v=74b4d273507a7e0eba857955bd45b2cf HTTP/1.1", host: "192.168.178.11", referrer: "https://192.168.178.11/manji/owncloud/"
Я думаю, что
location /manji/ {
является проблемой, но я теперь найти решение (~^запрещается, если используется proxy_pass)
если я пишу
location ~^ /manji/ {
я
sudo service nginx reload
Reloading nginx configuration: nginx: [emerg] "proxy_pass" cannot have URI part in location given by regular expression, or inside named location, or inside "if" statement, or inside "limit_except" block in /etc/nginx/sites-enabled/owncloud:99
Nginx: тест файл конфигурации /etc/nginx/nginx.conf не удалось