LightScribe 0 Posted August 14, 2018 Share Posted August 14, 2018 Hello! Im using VestaCP with nginx+php-fpm. I have enabled Rewrite URLs in admin panel (Search engine optimization). Problem is that Im using nginx and nginx doesnt using htaccess file which I needed for Rewrite URLs. I put this in my nginx config file, but when I visit my forum it just start downloading page. location /forums/ { if (!-e $request_filename){ rewrite \.(js|css|jpeg|jpg|gif|png|ico|map)(\?|$) /forums/forums/404error.php break; } if (!-e $request_filename){ rewrite ^/forums/(.*)$ /forums/forums/index.php break; } } What I did wrong? Link to comment Share on other sites More sharing options...
lkrou 1 Posted August 15, 2018 Share Posted August 15, 2018 You can use something like this : server { listen 80; server_name example.com; access_log logs/example.com_access.log; error_log logs/example.com_error.log; root /home/forums; index index.php; location / { try_files $uri $uri/ /index.php; } location ~ \.php$ { try_files $uri $uri/ /index.php; fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } Of course you will have to change it to suit your needs and may be add more security/performance related settings . Your issue "nginx start downloading your page (php file)" is due to php location not set or wrong configuration for : fastcgi_pass unix:/run/php/php7.0-fpm.sock; Link to comment Share on other sites More sharing options...
Recommended Posts