私はhttp-> httpsリダイレクト+非www-> wwwリダイレクトを設定しました。 2つのパスをhttpsにリダイレクトしないように除外します。 私は多くの可能な設定を試みました。私は404を取得するか、httpsバージョンにリダイレクトされます。ロケーションの例外を含むnginx/php-fpm - 404
はここ/ LOC2 /パスを取得しようとすると、404を返し、現在の設定、(#curl http://www.server.dev/loc2/18a9BM4Lay)です:
server {
listen 80;
listen [::]:80;
server_name server.dev;
location/{
return 301 https://$server_name$request_uri;
}
location /loc1/ {
try_files $uri $uri/ /index.php?$args;
}
location /loc2/ {
try_files $uri $uri/ /index.php?$args;
}
}
server {
listen 80;
listen [::]:80;
server_name www.server.dev;
root /var/www/web/server/public;
location/{
# return 301 https://$server_name$request_uri;
}
location ^~ /loc1/ {
# root /var/www/web/server/public;
index index.php;
# try_files $uri $uri/ /index.php?$args;
include pool_web.conf;
}
location ^~ /loc2/ {
# root /var/www/web/server/public;
index index.php;
# try_files $uri $uri/ /index.php?$args;
location ~ \.php$ {
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# Check that the PHP script exists before passing it
try_files $fastcgi_script_name =404;
# Bypass the fact that try_files resets $fastcgi_path_info
# see: http://trac.nginx.org/nginx/ticket/321
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
include fastcgi.conf;
fastcgi_read_timeout 360s;
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/server-php7.0-fpm.sock;
}
# include pool_web.conf;
}
}
server {
# listen 80;
# listen [::]:80;
listen 443 ssl http2;
ssl_certificate /etc/ssl/server.crt;
ssl_certificate_key /etc/ssl/server.key;
server_name server.dev;
rewrite ^ $scheme://www.server.dev$request_uri? permanent;
}
server {
# listen 80;
listen 443 ssl http2;
ssl_certificate /etc/ssl/server.crt;
ssl_certificate_key /etc/ssl/server.key;
server_name www.server.dev;
root /var/www/web/server/public;
index index.php;
location/{
try_files $uri $uri/ /index.php?$args;
}
location /images/ {
try_files $uri =404;
}
location ~ \.php$ {
include pool_web.conf;
}
location ~ \.(css|htc|less|js|js2|js3|js4)$ {
expires 31536000s;
add_header Pragma "public";
add_header Cache-Control "max-age=31536000, public";
}
location ~ \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|woff|xla|xls|xlsx|xlt|xlw|zip)$ {
expires 31536000s;
add_header Pragma "public";
add_header Cache-Control "max-age=31536000, public";
}
}
'/ var/www/web/server/public/loc2/18a9BM4Lay'というファイルがありますか?あるいは何か他のことが起こると思いますか? –
そのファイルは存在しません。むしろindex.phpは/ loc2 /パスを扱います。 – syst0m