Shopware 6.5 nginx配置

huangapple go评论88阅读模式
英文:

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

以下是您提供的配置文件的中文翻译部分:

  1. server {
  2. listen 80;
  3. index index.php index.html;
  4. server_name localhost;
  5. client_max_body_size 128M;
  6. root /var/www/html/public;
  7. location = /favicon.ico {
  8. log_not_found off;
  9. access_log off;
  10. }
  11. location = /sw-domain-hash.html {
  12. try_files $uri /index.php$is_args$args;
  13. }
  14. location ~* ^.+\.(?:css|cur|js|jpe?g|gif|ico|png|svg|webp|html)$ {
  15. expires max;
  16. add_header Cache-Control "public, must-revalidate, proxy-revalidate";
  17. access_log off;
  18. log_not_found off;
  19. tcp_nodelay off;
  20. ## 设置操作系统文件缓存。
  21. open_file_cache max=3000 inactive=120s;
  22. open_file_cache_valid 45s;
  23. open_file_cache_min_uses 2;
  24. open_file_cache_errors off;
  25. }
  26. # Shopware install / update
  27. # Shopware 6.5新增
  28. location /shopware-installer.phar.php {
  29. try_files $uri /shopware-installer.phar.php$is_args$args;
  30. }
  31. location /recovery/install {
  32. index index.php;
  33. try_files $uri /recovery/install/index.php$is_args$args;
  34. }
  35. location /recovery/update/ {
  36. location /recovery/update/assets {
  37. }
  38. if (!-e $request_filename){
  39. rewrite . /recovery/update/index.php last;
  40. }
  41. }
  42. location / {
  43. try_files $uri /index.php$is_args$args;
  44. }
  45. location ~ \.php$ {
  46. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  47. include fastcgi.conf;
  48. fastcgi_param HTTP_PROXY "";
  49. fastcgi_param HTTPS $fcgi_https;
  50. fastcgi_buffers 8 16k;
  51. fastcgi_buffer_size 32k;
  52. fastcgi_read_timeout 300s;
  53. client_body_buffer_size 128k;
  54. fastcgi_pass 127.0.0.1:9000;
  55. http2_push_preload on;
  56. }
  57. }

请注意,我已经将HTML实体“"”转换为双引号。

英文:
  1. server {
  2. listen 80;
  3. index index.php index.html;
  4. server_name localhost;
  5. client_max_body_size 128M;
  6. root /var/www/html/public;
  7. location = /favicon.ico {
  8. log_not_found off;
  9. access_log off;
  10. }
  11. location = /sw-domain-hash.html {
  12. try_files $uri /index.php$is_args$args;
  13. }
  14. location ~* ^.+\.(?:css|cur|js|jpe?g|gif|ico|png|svg|webp|html)$ {
  15. expires max;
  16. add_header Cache-Control "public, must-revalidate, proxy-revalidate";
  17. access_log off;
  18. log_not_found off;
  19. tcp_nodelay off;
  20. ## Set the OS file cache.
  21. open_file_cache max=3000 inactive=120s;
  22. open_file_cache_valid 45s;
  23. open_file_cache_min_uses 2;
  24. open_file_cache_errors off;
  25. }
  26. # Shopware install / update
  27. # new for Shopware 6.5
  28. location /shopware-installer.phar.php {
  29. try_files $uri /shopware-installer.phar.php$is_args$args;
  30. }
  31. location /recovery/install {
  32. index index.php;
  33. try_files $uri /recovery/install/index.php$is_args$args;
  34. }
  35. location /recovery/update/ {
  36. location /recovery/update/assets {
  37. }
  38. if (!-e $request_filename){
  39. rewrite . /recovery/update/index.php last;
  40. }
  41. }
  42. location / {
  43. try_files $uri /index.php$is_args$args;
  44. }
  45. location ~ \.php$ {
  46. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  47. include fastcgi.conf;
  48. fastcgi_param HTTP_PROXY "";
  49. fastcgi_param HTTPS $fcgi_https;
  50. fastcgi_buffers 8 16k;
  51. fastcgi_buffer_size 32k;
  52. fastcgi_read_timeout 300s;
  53. client_body_buffer_size 128k;
  54. fastcgi_pass 127.0.0.1:9000;
  55. http2_push_preload on;
  56. }
  57. }

huangapple
  • 本文由 发表于 2023年5月13日 21:02:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/76242873.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定