Apache to nginx
Daniel
daniel at linux-nerd.de
Mon Feb 13 09:23:44 UTC 2017
Hi,
i create a vhost confuguration for a vhost but i ma not able to access /vakanz for exmaple.
I got a 404 error on the access logs.
I Tried already with rewrite rules and i also tried with locations, no matter what i do, nothing works.
Anyone has an idea what can i do?
Cheers
Daniel
server {
listen 80;
root /var/www/vhosts/reisen/sbo/current/web;
rewrite ^/static/(.*) /var/www/vhosts/reisen/fe/static/$1 last;
rewrite ^/hrouter.js /var/www/vhosts/reisen/fe/index.php last;
rewrite ^/router.js /var/www/vhosts/reisen/fe/index.php last;
rewrite ^/(vakanz|vrij|ajax|boek|buchen)$ /var/www/vhosts/reisen/fe/index.php last;
rewrite ^/(vakanz|vrij|ajax|boek|buchen)/.* /var/www/vhosts/reisen/fe/index.php last;
rewrite ^/himage/.* /var/www/vhosts/reisen/fe/index.php last;
rewrite ^/image/.* /var/www/vhosts/reisen/fe/index.php last;
rewrite ^/images/.* /var/www/vhosts/reisen/fe/index.php last;
rewrite ^/nur-flug$ /flight/destination permanent;
set $my_https "off";
if ($http_x_forwarded_proto = "https") {
set $my_https "on";
}
server_name preprod.reisen.de;
location / {
index app.php;
add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept";
add_header Access-Control-Allow-Origin "*";
if (-f $request_filename) {
break;
}
try_files $uri @rewriteapp;
}
location @rewriteapp {
if ( $request_filename !~ opcache\.php ){
rewrite ^(.*)$ /app.php/$1 last;
}
}
#rewrite ^/(vakanz|vrij|ajax|boek|buchen)$ /var/www/vhosts/reisen/fe/index.php last;
#rewrite ^/(vakanz|vrij|ajax|boek|buchen)/.* /var/www/vhosts/reisen/fe/index.php last;
# location /vakanz {
# alias /var/www/vhosts/reisen/fe/;
# }
location ~* .js$
{add_header Service-Worker-Allowed "/";
}
location ~ ^/app\.php/_apilogger(/|$) {
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param HTTPS $my_https;
fastcgi_param SYMFONY__CMS__ENABLED false;
fastcgi_param CMS_ENABLED false;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept";
add_header Access-Control-Allow-Origin "*";
# Prevents URIs that include the front controller. This will 404:
# http://domain.tld/app.php/some-path
# Remove the internal directive to allow URIs like this
internal;
}
location ~ ^/proxy\.php(\?|/|$) {
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param HTTPS $my_https;
fastcgi_param SYMFONY__CMS__ENABLED false;
fastcgi_param CMS_ENABLED false;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept";
add_header Access-Control-Allow-Origin "*";
# Prevents URIs that include the front controller. This will 404:
# http://domain.tld/app.php/some-path
# Remove the internal directive to allow URIs like this
#internal;
}
location ~ ^/app\.php(/|$) {
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param HTTPS $my_https;
fastcgi_param SYMFONY__CMS__ENABLED false;
fastcgi_param CMS_ENABLED false;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept";
add_header Access-Control-Allow-Origin "*";
# Prevents URIs that include the front controller. This will 404:
# http://domain.tld/app.php/some-path
# Remove the internal directive to allow URIs like this
internal;
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20170213/b191c527/attachment.html>
More information about the nginx
mailing list