[ad_1]
hello.
I am using Nginx and running a multilingual website using subdirectories.
The root domain and subdirectories operate separately and are not configured as multisite.
However, I put the code for Nginx in the FAQ into the server block, but I keep getting “Server configuration error”.
I tried modifying the code several times to solve this problem, but nothing worked.
Can you tell me how to solve this problem? Next is my server block.
thank you
server {
listen 443 ssl http2;
server_name example.com www.example.com;
root /var/www/vg;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ^~ /en {
try_files $uri $uri/ /en/index.php?$args;
# BEGIN Converter for Media
set $ext_avif ".avif";
if ($http_accept !~* "image/avif") {
set $ext_avif "";
}
set $ext_webp ".webp";
if ($http_accept !~* "image/webp") {
set $ext_webp "";
}
location ~ /wp-content/(?<path>.+)\.(?<ext>jpe?g|png|gif|webp)$ {
add_header Vary Accept;
expires 365d;
try_files
/wp-content/uploads-webpc/$path.$ext$ext_avif
/wp-content/uploads-webpc/$path.$ext$ext_webp
$uri =404;
}
# END Converter for Media
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
#여기까지 설정은 spinupwp 설정임.
error_log /var/log/nginx/example.com2.error.log;
fastcgi_cache ashleyrich2.com;
fastcgi_cache_valid 60m; # 200 OK 응답을 60분 동안 캐시
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
}
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
#이렇게 크게 할 필요가 있나?
fastcgi_buffers 64 16k; # default 8 4k
# 502 에러를 없애기 위한 fastcgi 버퍼 관련 설정입니다.
fastcgi_buffering on;
fastcgi_buffer_size 16k;
# 최대 timeout 설정입니다.
fastcgi_connect_timeout 120s;
fastcgi_send_timeout 120s;
fastcgi_read_timeout 120s;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
fastcgi_cache ashleyrich.com;
fastcgi_cache_valid 60m;
}
}
