在子文件夹中运行的Magento的Nginx配置
我想将Magento的附加副本安装到子文件夹。它应该与URL重写一起工作。请告诉我在默认配置中应该做什么更改(也可以在此处找到-):在子文件夹中运行的Magento的Nginx配置,magento,nginx,Magento,Nginx,我想将Magento的附加副本安装到子文件夹。它应该与URL重写一起工作。请告诉我在默认配置中应该做什么更改(也可以在此处找到-): 我已经找到了一个基本上有效的解决方案,这里有更详细的概述: 我使用proxy_pass重写URL,并根据URL子目录将其发送到单独的Nginx服务器指令。第二个server指令设置存储代码,其余由Magento处理。我不确定这是不是最优雅的解决方案,但它确实有效 server { listen 80 default; server_name w
我已经找到了一个基本上有效的解决方案,这里有更详细的概述: 我使用proxy_pass重写URL,并根据URL子目录将其发送到单独的Nginx服务器指令。第二个server指令设置存储代码,其余由Magento处理。我不确定这是不是最优雅的解决方案,但它确实有效
server {
listen 80 default;
server_name www.DOMAIN.com *.DOMAIN.com;
root /var/www/vhosts/DOMAIN.com;
## Serve static files from the server on 80
location ^~ /media/ {}
location ^~ /skin/ {}
location ^~ /js/ {}
location ~* \.(js|css|png|jpg|jpeg|gif|ico|swf|fla)$ {
expires 1y;
log_not_found off;
}
location /STORE_CODE {
rewrite ^/STORE_CODE/(.*) /$1 break;
proxy_pass http://localhost:82;
proxy_set_header X-Real-IP $remote_addr;
}
location / {
proxy_pass http://localhost:81;
proxy_set_header X-Real-IP $remote_addr;
}
}
然后使用现有配置为端口81和82创建服务器指令,如下所示:
server {
listen localhost:81 default; # Make sure you change the port here!
... # Same configuration otherwise
}
server {
listen localhost:82 default; # Make sure you change the port here!
... # Same configuration, except for:
location ~ .php$ { ## Execute PHP scripts
if (!-e $request_filename) { rewrite / /index.php last; } ## Catch 404s that try_files miss
expires off; ## Do not cache dynamic content
fastcgi_pass 127.0.0.1:9000;
fastcgi_param HTTPS $fastcgi_https;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE store_code; ## CHANGE THIS TO YOUR STORE CODE!
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params; ## See /etc/nginx/fastcgi_params
}
您需要将第二个存储的基本url设置为http://www.DOMAIN.com/STORE_CODE/
。其余的由Magento负责
希望这有帮助 我找到了一个基本有效的解决方案,这里有更详细的介绍: 我使用proxy_pass重写URL,并根据URL子目录将其发送到单独的Nginx服务器指令。第二个server指令设置存储代码,其余由Magento处理。我不确定这是不是最优雅的解决方案,但它确实有效
server {
listen 80 default;
server_name www.DOMAIN.com *.DOMAIN.com;
root /var/www/vhosts/DOMAIN.com;
## Serve static files from the server on 80
location ^~ /media/ {}
location ^~ /skin/ {}
location ^~ /js/ {}
location ~* \.(js|css|png|jpg|jpeg|gif|ico|swf|fla)$ {
expires 1y;
log_not_found off;
}
location /STORE_CODE {
rewrite ^/STORE_CODE/(.*) /$1 break;
proxy_pass http://localhost:82;
proxy_set_header X-Real-IP $remote_addr;
}
location / {
proxy_pass http://localhost:81;
proxy_set_header X-Real-IP $remote_addr;
}
}
然后使用现有配置为端口81和82创建服务器指令,如下所示:
server {
listen localhost:81 default; # Make sure you change the port here!
... # Same configuration otherwise
}
server {
listen localhost:82 default; # Make sure you change the port here!
... # Same configuration, except for:
location ~ .php$ { ## Execute PHP scripts
if (!-e $request_filename) { rewrite / /index.php last; } ## Catch 404s that try_files miss
expires off; ## Do not cache dynamic content
fastcgi_pass 127.0.0.1:9000;
fastcgi_param HTTPS $fastcgi_https;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE store_code; ## CHANGE THIS TO YOUR STORE CODE!
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params; ## See /etc/nginx/fastcgi_params
}
您需要将第二个存储的基本url设置为http://www.DOMAIN.com/STORE_CODE/
。其余的由Magento负责
希望这有帮助 您的其他安装是否具有不同的域?或者只是将/directory/添加到主域?只是将/directory/添加到主域配置这将是一件令人头痛的事情。您能解释一下为什么要这样做吗?我的根文件夹(/var/www)中安装了Magento。我想在根目录/子目录中设置开发应用商店。您的其他安装是否有其他域?或者只是将/directory/添加到主域?只是将/directory/添加到主域配置这将是一件令人头痛的事情。您能解释一下为什么要这样做吗?我的根文件夹(/var/www)中安装了Magento。我想在根目录/子目录中设置开发存储。