Depois de muitas horas pesquisando e pesquisando, ainda não consegui fazer isso funcionar. Eu tenho um magento funcional instalado em / srv / site1 / htdocs. Eu tenho outra instalação do magento em / srv / site2 / htdocs. Eu preciso site2 para carregar em site1.com/site2/. Tricky certo?
Até agora eu tenho site1.com/site2 carregando uma página 404 sem estilo para o site2 magento install, e tudo o mais dentro desse diretório gera um erro 404. Aqui está todo o conf nginx:
server {
listen 80;
server_name site1.com;
root /srv/site1.com/htdocs;
index index.php;
client_max_body_size 500M;
location ~ /site2 {
root /srv/site2/htdocs;
add_header Access-Control-Allow-Origin "*";
index index.php index.html;
try_files $uri $uri/ /index.php?$args;
expires 30d;
location ~* \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass unix:/var/run/php-fpm/www.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_read_timeout 20000000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include mime.types;
}
location ~ /site2/.+\.php$ {
root /srv/site2/htdocs;
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass unix:/var/run/php-fpm/www.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_read_timeout 20000000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include mime.types;
}
}
location / {
add_header Access-Control-Allow-Origin "*";
index index.php; ## Allow a static html file to be shown first
try_files $uri $uri/ /index.php?$args;
expires 30d;
}
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types
text/plain
text/css
text/js
text/xml
text/javascript
application/javascript
application/x-javascript
application/json
application/xml
application/xml+rss;
## These locations would be hidden by .htaccess normally
#location ^~ /app/ { deny all; }
location ^~ /includes/ { deny all; }
location ^~ /lib/ { deny all; }
location ^~ /media/downloadable/ { deny all; }
location ^~ /pkginfo/ { deny all; }
location ^~ /report/config.xml { deny all; }
location ^~ /var/ { deny all; }
location /var/export/ { ## Allow admins only to view export folder
auth_basic "Restricted"; ## Message shown in login window
auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword
autoindex on;
}
location ~ /\.htaccess { ## Disable .htaccess and other hidden files
return 404;
}
location ~ \.php$ {
if ($request_uri ~ /site2/.*$) {
root /srv/site2/htdocs;
}
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass unix:/var/run/php-fpm/www.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_read_timeout 20000000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include mime.types;
}
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
expires -1;
}
# Feed
location ~* \.(?:rss|atom)$ {
expires 1h;
add_header Cache-Control "public";
}
# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}
# CSS and Javascript
location ~* \.(?:css|js)$ {
expires 1y;
access_log off;
add_header Cache-Control "public";
}
}
Bit de algum código redundante lá com certeza. Quase no final da minha vida aqui. Alguma ideia? Também precisarei fazer isso para mais um site magento, site1.com/site3. Coisas divertidas, de fato.