Welcome! Log In Create A New Profile

Advanced

Apache to nginx

Daniel
February 13, 2017 04:24AM
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;

}





}


_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Apache to nginx

Daniel February 13, 2017 04:24AM

Re: Apache to nginx

Francis Daly February 13, 2017 01:52PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 170
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready