Nginx ignoruje nazwę serwera
Mam dwa bloki serwera
server {
listen 80 default_server;
listen 443 default_server ssl;
server_name www.example.com example.com;
root/var/www/webpage
index index.php;client_max_body_size 3800m;location =/favicon.ico {
log_not_found off;
access_log off;
}location =/robots.txt {
allow all;
log_not_found off;
access_log off;
}location/{
try_files $uri $uri//index.php?q=$uri&$args;
}# pass the PHP scripts to FastCGI server listening on the php-fpm socket
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}}
i
server {
listen 80;
server_name cloud.example.com;
# enforce https
return 301 https://$server_name$request_uri;
}server {
listen 443 ssl;
server_name cloud.example.com;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
ssl_prefer_server_ciphers on;
ssl_dhparam/etc/nginx/ssl/dhparam.pem; # Add headers to serve security related headers
add_header Strict-Transport-Security "max-age=15768000; preload;"; root/var/www/owncloud/; # set max upload size
client_max_body_size 10G;
fastcgi_buffers 64 4K; rewrite ^/caldav(.*)$/remote.php/caldav$1 redirect;
rewrite ^/carddav(.*)$/remote.php/carddav$1 redirect;
rewrite ^/webdav(.*)$/remote.php/webdav$1 redirect; index index.php;
error_page 403/core/templates/403.php;
error_page 404/core/templates/404.php; location =/robots.txt {
allow all;
log_not_found off;
access_log off;
} location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README){
deny all;
} location/{
# The following 2 rules are only needed with webfinger
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 ^(/core/doc/[^\/]+/)$ $1/index.html; try_files $uri $uri//index.php;
}location ~ \.php(?:$|/) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PHP_VALUE "upload_max_filesize = 8000M
post_max_size = 8000M
output_buffering = 0";
fastcgi_param HTTPS on;
} # Optional: set long EXPIRES header on static assets
location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
expires 30d;
access_log off;
}}
ale teraz, kiedy odwiedzam
[url=https://example.com]https://example.com[/url]
nginx służy
/var/www/owncloud.
Dla
[url=https://www.example.com]https://www.example.com[/url]
[url=http://example.com]http://example.com[/url]
[url=http://www.example.com]http://www.example.com[/url]
/var/www/webpageserwowane do woli.
Nie znaleziono powiązanych wyników
Zaproszony:
Aby odpowiedzieć na pytania, Zaloguj się lub Zarejestruj się
1 odpowiedzi
Anonimowy użytkownik
Potwierdzenie od:
default_server
.
Otrzyma cały ruch HTTP dla www.example.com i example.com.
Otrzyma cały ruch HTTPS dla www.example.com i example.com.
Należy pamiętać, że są to 2 oddzielne pliki wirtualne. Nie dodawaj do siebie 80 i 443. Powyższe ustawienie nie wymusza przekierowania HTTP na HTTPS.
Poniżej znajdziesz informacje na temat własnej chmury.
Uwaga: określ domenę w przekierowaniu