VPS侦探论坛

 找回密码
 注册
查看: 1782|回复: 12

请问如何在LNMPA下安装magento2.4?

[复制链接]
发表于 2023-2-28 11:36:39 | 显示全部楼层 |阅读模式

我想试下在LNMPA下安装magento2.4, 军哥能给个安装指导吗?目前https://www.rxsafetyglassescanada.com 是安装在lnmp下的, 感觉访问速度一般。我想试下LNMPA, 而且我也很想再用.htaccess来进行安装设置。 谢谢了!

美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2023-2-28 18:20:13 | 显示全部楼层


安装步骤lnmp和lnmpa都一样的,lnmpa可用直接用 .htaccess
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2023-3-19 21:53:13 | 显示全部楼层

lnmpa安装magento2.4有没有其它的什么设置要求?虚拟主机是根据nginx,还是apache来设置的?
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2023-3-20 20:51:09 | 显示全部楼层



yisou 发表于 2023-3-19 21:53
lnmpa安装magento2.4有没有其它的什么设置要求?虚拟主机是根据nginx,还是apache来设置的? ...

这种需要大量修改配置文件的就lnmpa最麻烦
lnmp vhost add 添加完改nginx的配置文件,按example中的例子配置文件改,动态的内容发代到apache上
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2023-3-21 10:50:20 | 显示全部楼层

licess 发表于 2023-3-20 20:51
这种需要大量修改配置文件的就lnmpa最麻烦
lnmp vhost add 添加完改nginx的配置文件,按example中的例子 ...

军哥, 能麻烦你有时间时结合magento2.4.6与lnmpa来一套教学吗?包括安装,配置,以及nginx, mysql, php, apache的优化?

军哥运维代购:http://shop63846532.taobao.com/

发表于 2023-3-22 12:55:34 | 显示全部楼层

yisou 发表于 2023-3-21 10:50
军哥, 能麻烦你有时间时结合magento2.4.6与lnmpa来一套教学吗?包括安装,配置,以及nginx, mysql, php, ...
  1. server
  2.     {
  3.         listen 80;
  4.         #listen [::]:80;
  5.         server_name lnmp.org www.lnmp.org;
  6.         index index.php;
  7.         set $MAGE_ROOT /home/wwwroot/lnmp.org;

  8.         #如果需要http 301跳转到 https 需要将下面行前面的 # 注释去掉,并重载nginx
  9.         #return 301 https://lnmp.org$request_uri;

  10.         root $MAGE_ROOT/pub;
  11.         autoindex off;
  12.         charset UTF-8;
  13.         error_page 404 403 = /errors/404.php;
  14.         #add_header "X-UA-Compatible" "IE=Edge";

  15.         # Deny access to sensitive files
  16.         location /.user.ini {
  17.             deny all;
  18.         }

  19.         # PHP entry point for setup application
  20.         location ~* ^/setup($|/) {
  21.             root $MAGE_ROOT;
  22.             location ~ ^/setup/index.php {
  23.                 proxy_pass http://127.0.0.1:88;
  24.                 include proxy.conf;
  25.             }

  26.             location ~ ^/setup/(?!pub/). {
  27.                 deny all;
  28.             }

  29.             location ~ ^/setup/pub/ {
  30.                 add_header X-Frame-Options "SAMEORIGIN";
  31.             }
  32.         }

  33.         # PHP entry point for update application
  34.         location ~* ^/update($|/) {
  35.             root $MAGE_ROOT;

  36.             location ~ ^/update/index.php {
  37.                 proxy_pass http://127.0.0.1:88;
  38.                 include proxy.conf;
  39.             }

  40.             # Deny everything but index.php
  41.             location ~ ^/update/(?!pub/). {
  42.                 deny all;
  43.             }

  44.             location ~ ^/update/pub/ {
  45.                 add_header X-Frame-Options "SAMEORIGIN";
  46.             }
  47.         }

  48.         location / {
  49.             try_files $uri $uri/ /index.php$is_args$args;
  50.         }

  51.         location /pub/ {
  52.             location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) {
  53.                 deny all;
  54.             }
  55.             alias $MAGE_ROOT/pub/;
  56.             add_header X-Frame-Options "SAMEORIGIN";
  57.         }

  58.         location /static/ {
  59.             # Uncomment the following line in production mode
  60.             # expires max;

  61.             # Remove signature of the static files that is used to overcome the browser cache
  62.             location ~ ^/static/version {
  63.                 rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last;
  64.             }

  65.             location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2|json)$ {
  66.                 add_header Cache-Control "public";
  67.                 add_header X-Frame-Options "SAMEORIGIN";
  68.                 expires +1y;

  69.                 if (!-f $request_filename) {
  70.                     rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
  71.                 }
  72.             }
  73.             location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
  74.                 add_header Cache-Control "no-store";
  75.                 add_header X-Frame-Options "SAMEORIGIN";
  76.                 expires    off;

  77.                 if (!-f $request_filename) {
  78.                    rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
  79.                 }
  80.             }
  81.             if (!-f $request_filename) {
  82.                 rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
  83.             }
  84.             add_header X-Frame-Options "SAMEORIGIN";
  85.         }

  86.         location /media/ {
  87.             try_files $uri $uri/ /get.php$is_args$args;

  88.             location ~ ^/media/theme_customization/.*\.xml {
  89.                 deny all;
  90.             }

  91.             location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
  92.                 add_header Cache-Control "public";
  93.                 add_header X-Frame-Options "SAMEORIGIN";
  94.                 expires +1y;
  95.                 try_files $uri $uri/ /get.php$is_args$args;
  96.             }
  97.             location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
  98.                 add_header Cache-Control "no-store";
  99.                 add_header X-Frame-Options "SAMEORIGIN";
  100.                 expires    off;
  101.                 try_files $uri $uri/ /get.php$is_args$args;
  102.             }
  103.             add_header X-Frame-Options "SAMEORIGIN";
  104.         }

  105.         location /media/customer/ {
  106.             deny all;
  107.         }

  108.         location /media/downloadable/ {
  109.             deny all;
  110.         }

  111.         location /media/import/ {
  112.             deny all;
  113.         }
  114.         location /errors/ {
  115.             location ~* \.xml$ {
  116.                 deny all;
  117.             }
  118.         }

  119.         # PHP entry point for main application
  120.         location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check)\.php$ {
  121.             proxy_pass http://127.0.0.1:88;
  122.             include proxy.conf;
  123.         }

  124.         gzip on;
  125.         gzip_disable "msie6";

  126.         gzip_comp_level 6;
  127.         gzip_min_length 1100;
  128.         gzip_buffers 16 8k;
  129.         gzip_proxied any;
  130.         gzip_types
  131.             text/plain
  132.             text/css
  133.             text/js
  134.             text/xml
  135.             text/javascript
  136.             application/javascript
  137.             application/x-javascript
  138.             application/json
  139.             application/xml
  140.             application/xml+rss
  141.             image/svg+xml;
  142.         gzip_vary on;

  143.         location ~ /.well-known {
  144.             allow all;
  145.         }

  146.         # Banned locations (only reached if the earlier PHP entry point regexes don't match)
  147.         location ~* (\.php$|\.phtml$|\.htaccess$|\.git) {
  148.             deny all;
  149.         }
  150.     }
复制代码

仅供参考,自行测试
 楼主| 发表于 2023-3-23 10:10:11 | 显示全部楼层

谢谢,我在本地测试下。
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2023-5-31 12:17:22 | 显示全部楼层

server
    {
        listen 80;
        #listen [::]:80;
        server_name glassescode.com www.glassescode.com;
        index index.php;
        set $MAGE_ROOT /home/wwwroot/glassescode.com;

        #如果需要http 301跳转到 https 需要将下面行前面的 # 注释去掉,并重载nginx
        return 301 https://www.glassescode.com$request_uri;

        root $MAGE_ROOT/pub;
        autoindex off;
        charset UTF-8;
        error_page 404 403 = /errors/404.php;
        #add_header "X-UA-Compatible" "IE=Edge";

        # Deny access to sensitive files
        location /.user.ini {
            deny all;
        }

        # PHP entry point for setup application
        location ~* ^/setup($|/) {
            root $MAGE_ROOT;
            location ~ ^/setup/index.php {
                proxy_pass http://127.0.0.1:88;
                include proxy.conf;
            }

            location ~ ^/setup/(?!pub/). {
                deny all;
            }

            location ~ ^/setup/pub/ {
                add_header X-Frame-Options "SAMEORIGIN";
            }
        }

        # PHP entry point for update application
        location ~* ^/update($|/) {
            root $MAGE_ROOT;

            location ~ ^/update/index.php {
                proxy_pass http://127.0.0.1:88;
                include proxy.conf;
            }

            # Deny everything but index.php
            location ~ ^/update/(?!pub/). {
                deny all;
            }

            location ~ ^/update/pub/ {
                add_header X-Frame-Options "SAMEORIGIN";
            }
        }

        location / {
            try_files $uri $uri/ /index.php$is_args$args;
        }

        location /pub/ {
            location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) {
                deny all;
            }
            alias $MAGE_ROOT/pub/;
            add_header X-Frame-Options "SAMEORIGIN";
        }

        location /static/ {
            # Uncomment the following line in production mode
            # expires max;

            # Remove signature of the static files that is used to overcome the browser cache
            location ~ ^/static/version {
                rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last;
            }

            location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2|json)$ {
                add_header Cache-Control "public";
                add_header X-Frame-Options "SAMEORIGIN";
                expires +1y;

                if (!-f $request_filename) {
                    rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
                }
            }
            location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
                add_header Cache-Control "no-store";
                add_header X-Frame-Options "SAMEORIGIN";
                expires    off;

                if (!-f $request_filename) {
                   rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
                }
            }
            if (!-f $request_filename) {
                rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
            }
            add_header X-Frame-Options "SAMEORIGIN";
        }

        location /media/ {
            try_files $uri $uri/ /get.php$is_args$args;

            location ~ ^/media/theme_customization/.*\.xml {
                deny all;
            }

            location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
                add_header Cache-Control "public";
                add_header X-Frame-Options "SAMEORIGIN";
                expires +1y;
                try_files $uri $uri/ /get.php$is_args$args;
            }
            location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
                add_header Cache-Control "no-store";
                add_header X-Frame-Options "SAMEORIGIN";
                expires    off;
                try_files $uri $uri/ /get.php$is_args$args;
            }
            add_header X-Frame-Options "SAMEORIGIN";
        }

        location /media/customer/ {
            deny all;
        }

        location /media/downloadable/ {
            deny all;
        }

        location /media/import/ {
            deny all;
        }
        location /errors/ {
            location ~* \.xml$ {
                deny all;
            }
        }

        # PHP entry point for main application
        location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check)\.php$ {
            proxy_pass http://127.0.0.1:88;
            include proxy.conf;
        }

        gzip on;
        gzip_disable "msie6";

        gzip_comp_level 6;
        gzip_min_length 1100;
        gzip_buffers 16 8k;
        gzip_proxied any;
        gzip_types
            text/plain
            text/css
            text/js
            text/xml
            text/javascript
            application/javascript
            application/x-javascript
            application/json
            application/xml
            application/xml+rss
            image/svg+xml;
        gzip_vary on;

        location ~ /.well-known {
            allow all;
        }

        # Banned locations (only reached if the earlier PHP entry point regexes don't match)
        location ~* (\.php$|\.phtml$|\.htaccess$|\.git) {
            deny all;
        }
    }
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2023-5-31 12:17:44 | 显示全部楼层


server
    {
        listen 443 ssl http2;
        #listen [::]:443 ssl http2;
        server_name glassescode.com www.glassescode.com;
        index index.php;
        set $MAGE_ROOT /home/wwwroot/glassescode.com;

        root $MAGE_ROOT/pub;
        autoindex off;
        charset UTF-8;


        ssl_certificate /usr/local/nginx/conf/ssl/www.glassescode.com/fullchain.cer;
        ssl_certificate_key /usr/local/nginx/conf/ssl/www.glassescode.com/www.glassescode.com.key;
        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
        ssl_prefer_server_ciphers on;
        ssl_ciphers "TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
        ssl_session_cache builtin:1000 shared:SSL:10m;
        # openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
        ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;
        error_page 404 403 = /errors/404.php;
        #add_header "X-UA-Compatible" "IE=Edge";

        # Deny access to sensitive files
        location /.user.ini {
            deny all;
        }

        # PHP entry point for setup application
        location ~* ^/setup($|/) {
            root $MAGE_ROOT;
            location ~ ^/setup/index.php {
                proxy_pass http://127.0.0.1:88;
                include proxy.conf;
            }

            location ~ ^/setup/(?!pub/). {
                deny all;
            }

            location ~ ^/setup/pub/ {
                add_header X-Frame-Options "SAMEORIGIN";
            }
        }

        # PHP entry point for update application
        location ~* ^/update($|/) {
            root $MAGE_ROOT;

            location ~ ^/update/index.php {
                proxy_pass http://127.0.0.1:88;
                include proxy.conf;
            }

            # Deny everything but index.php
            location ~ ^/update/(?!pub/). {
                deny all;
            }

            location ~ ^/update/pub/ {
                add_header X-Frame-Options "SAMEORIGIN";
            }
        }

        location / {
            try_files $uri $uri/ /index.php$is_args$args;
        }

        location /pub/ {
            location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) {
                deny all;
            }
            alias $MAGE_ROOT/pub/;
            add_header X-Frame-Options "SAMEORIGIN";
        }

        location /static/ {
            # Uncomment the following line in production mode
            # expires max;

            # Remove signature of the static files that is used to overcome the browser cache
            location ~ ^/static/version {
                rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last;
            }

            location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2|json)$ {
                add_header Cache-Control "public";
                add_header X-Frame-Options "SAMEORIGIN";
                expires +1y;

                if (!-f $request_filename) {
                    rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
                }
            }
            location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
                add_header Cache-Control "no-store";
                add_header X-Frame-Options "SAMEORIGIN";
                expires    off;

                if (!-f $request_filename) {
                   rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
                }
            }
            if (!-f $request_filename) {
                rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
            }
            add_header X-Frame-Options "SAMEORIGIN";
        }

        location /media/ {
            try_files $uri $uri/ /get.php$is_args$args;

            location ~ ^/media/theme_customization/.*\.xml {
                deny all;
            }

            location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
                add_header Cache-Control "public";
                add_header X-Frame-Options "SAMEORIGIN";
                expires +1y;
                try_files $uri $uri/ /get.php$is_args$args;
            }
            location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
                add_header Cache-Control "no-store";
                add_header X-Frame-Options "SAMEORIGIN";
                expires    off;
                try_files $uri $uri/ /get.php$is_args$args;
            }
            add_header X-Frame-Options "SAMEORIGIN";
        }

        location /media/customer/ {
            deny all;
        }

        location /media/downloadable/ {
            deny all;
        }

        location /media/import/ {
            deny all;
        }
        location /errors/ {
            location ~* \.xml$ {
                deny all;
            }
        }

        # PHP entry point for main application
        location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check)\.php$ {
            proxy_pass http://127.0.0.1:88;
            include proxy.conf;
        }

        gzip on;
        gzip_disable "msie6";

        gzip_comp_level 6;
        gzip_min_length 1100;
        gzip_buffers 16 8k;
        gzip_proxied any;
        gzip_types
            text/plain
            text/css
            text/js
            text/xml
            text/javascript
            application/javascript
            application/x-javascript
            application/json
            application/xml
            application/xml+rss
            image/svg+xml;
        gzip_vary on;

        location ~ /.well-known {
            allow all;
        }

        # Banned locations (only reached if the earlier PHP entry point regexes don't match)
        location ~* (\.php$|\.phtml$|\.htaccess$|\.git) {
            deny all;
        }
    }

军哥运维代购:http://shop63846532.taobao.com/

 楼主| 发表于 2023-5-31 12:18:23 | 显示全部楼层



该网页无法正常运作
www.glassescode.com 将您重定向的次数过多。

ERR_TOO_MANY_REDIRECTS

军哥,请问如何处理呀。
发表于 2023-6-1 08:29:26 | 显示全部楼层

yisou 发表于 2023-5-31 12:18
该网页无法正常运作
www.glassescode.com 将您重定向的次数过多。

我这边curl这个域名看没有多重重定向

清空浏览器缓存或者换个浏览器看一下
 楼主| 发表于 2023-6-1 19:23:06 | 显示全部楼层

军哥,有时间来一套lnmpa安装magento2.4.6的教学吧。
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-10-18 12:02 , Processed in 0.029811 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表