英文:
Shopware 6.5 nginx configuration
问题
我运行一些Shopware 6.4.x商店。
然而,这些商店正在运行在一个nginx服务器上。
由于我想继续使用nginx,我想问一下是否已经有nginx的配置模板可用。
我尝试将.htaccess文件转换成nginx配置文件。
但是我没有成功地正确翻译这部分内容:
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.)::\2$
RewriteRule ^(.) - [E=BASE:%1]
英文:
I run some shopware 6.4.x shops.
However, these are running on an nginx server.
Since I would like to continue running nginx, I wanted to ask if there are already configuration templates for nginx.
I have tried to rewrite the .htaccess into a nginx config.
But I didn't manage to translate this part correctly:
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.)::\2$
RewriteRule ^(.) - [E=BASE:%1]
答案1
得分: 1
以下是您提供的配置文件的中文翻译部分:
server {
listen 80;
index index.php index.html;
server_name localhost;
client_max_body_size 128M;
root /var/www/html/public;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /sw-domain-hash.html {
try_files $uri /index.php$is_args$args;
}
location ~* ^.+\.(?:css|cur|js|jpe?g|gif|ico|png|svg|webp|html)$ {
expires max;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
access_log off;
log_not_found off;
tcp_nodelay off;
## 设置操作系统文件缓存。
open_file_cache max=3000 inactive=120s;
open_file_cache_valid 45s;
open_file_cache_min_uses 2;
open_file_cache_errors off;
}
# Shopware install / update
# Shopware 6.5新增
location /shopware-installer.phar.php {
try_files $uri /shopware-installer.phar.php$is_args$args;
}
location /recovery/install {
index index.php;
try_files $uri /recovery/install/index.php$is_args$args;
}
location /recovery/update/ {
location /recovery/update/assets {
}
if (!-e $request_filename){
rewrite . /recovery/update/index.php last;
}
}
location / {
try_files $uri /index.php$is_args$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi.conf;
fastcgi_param HTTP_PROXY "";
fastcgi_param HTTPS $fcgi_https;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_read_timeout 300s;
client_body_buffer_size 128k;
fastcgi_pass 127.0.0.1:9000;
http2_push_preload on;
}
}
请注意,我已经将HTML实体“"”转换为双引号。
英文:
server {
listen 80;
index index.php index.html;
server_name localhost;
client_max_body_size 128M;
root /var/www/html/public;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /sw-domain-hash.html {
try_files $uri /index.php$is_args$args;
}
location ~* ^.+\.(?:css|cur|js|jpe?g|gif|ico|png|svg|webp|html)$ {
expires max;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
access_log off;
log_not_found off;
tcp_nodelay off;
## Set the OS file cache.
open_file_cache max=3000 inactive=120s;
open_file_cache_valid 45s;
open_file_cache_min_uses 2;
open_file_cache_errors off;
}
# Shopware install / update
# new for Shopware 6.5
location /shopware-installer.phar.php {
try_files $uri /shopware-installer.phar.php$is_args$args;
}
location /recovery/install {
index index.php;
try_files $uri /recovery/install/index.php$is_args$args;
}
location /recovery/update/ {
location /recovery/update/assets {
}
if (!-e $request_filename){
rewrite . /recovery/update/index.php last;
}
}
location / {
try_files $uri /index.php$is_args$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi.conf;
fastcgi_param HTTP_PROXY "";
fastcgi_param HTTPS $fcgi_https;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_read_timeout 300s;
client_body_buffer_size 128k;
fastcgi_pass 127.0.0.1:9000;
http2_push_preload on;
}
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论