嘿嘿,
我有以下情况:我有两个系统正在运行(Magento 和 Codeigniter),它们应该在同一个 url 下运行。Magento 只负责几个 url:
http://dev/checkout
,http://dev/kasse
例如应该由位于的 magento 提供服务/vagrant/magento
所有其他请求应由位于的 codeigniter 提供服务/vagrant/codeigniter
我有点让它工作,但它使用 if's 并且我必须将文件夹添加到两个文件中,这不太好。而且php有时认为它的根位于错误的文件夹中(/vagrant/
没有magento文件夹)
我做错了什么以及如何做对?
谢谢!
# ./sites-available/default
server {
listen 80;
listen [::]:80 default_server ipv6only=on;
server_name rh.dev;
root /vagrant/codeigniter/;
location ~ /(kasse|tools|checkout|warenkorb|skin|media) {
alias /vagrant/magento/;
index index.php;
try_files $uri $uri/ @handler;
}
location / {
index index.php;
if ($request_uri ~* "\.(ico|css|js|gif|jpe?g|png)$") {
access_log off;
expires max;
}
try_files $uri $uri/ @handler;
}
location @handler {
rewrite / /index.php;
}
location ~.php/ {
rewrite ^(.*.php)/ $1 last;
}
include /etc/nginx/php.conf;
}
# ./php.conf
fastcgi_intercept_errors on;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
set $php_root /vagrant/codeigniter/;
if ( $request_uri ~ /(kasse|tools|checkout|warenkorb|skin|media) ) {
set $php_root /vagrant/magento/;
}
include fastcgi_params;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
# ./fastcgi_params
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
#fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param SCRIPT_FILENAME $php_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param HTTPS $https;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;