Hi, I'm just new to nginx, even if my apache experience isn't so deep. Recently I bought a new sd memory for my Raspberry and decided to try archlinux with nginx (previously I used raspbian with apache). I use the webserver to run some services, like owncloud, lilina, wtorrent. In my previous setup I accessed them pointing the url this way: server_ip/owncloud, server_ip/lilina, server_ip/wtorrent, etc. In my new setup I started configuring owncloud; I read some example and created a server block:
# owncloud (ssl/tls)
server {
listen 443 ssl;
ssl_certificate /etc/nginx/server.crt;
ssl_certificate_key /etc/nginx/server.key;
server_name owncloud.example.org;
root /usr/share/webapps/owncloud;
index index.php;
client_max_body_size 1000M; # set maximum upload size
# deny direct access
location ~ ^/(data|config|\.ht|db_structure\.xml|README) {
deny all;
}
# default try order
location / {
try_files $uri $uri/ @webdav;
}
# owncloud WebDAV
location @webdav {
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS on;
include fastcgi_params;
}
# enable php
location ~ \.php$ {
try_files $uri = 404;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS on;
include fastcgi_params;
}
}
It works but not as expected; server_ip/owncloud gives me an error while server_ip is ok. But this is a problem when I install other services. Can you explain me the right configuration?
Many thanks
# owncloud (ssl/tls)
server {
listen 443 ssl;
ssl_certificate /etc/nginx/server.crt;
ssl_certificate_key /etc/nginx/server.key;
server_name owncloud.example.org;
root /usr/share/webapps/owncloud;
index index.php;
client_max_body_size 1000M; # set maximum upload size
# deny direct access
location ~ ^/(data|config|\.ht|db_structure\.xml|README) {
deny all;
}
# default try order
location / {
try_files $uri $uri/ @webdav;
}
# owncloud WebDAV
location @webdav {
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS on;
include fastcgi_params;
}
# enable php
location ~ \.php$ {
try_files $uri = 404;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS on;
include fastcgi_params;
}
}
It works but not as expected; server_ip/owncloud gives me an error while server_ip is ok. But this is a problem when I install other services. Can you explain me the right configuration?
Many thanks