Rewrite .htaccess on nginx

Jorge Enrique Diaz nginx-forum at forum.nginx.org
Tue Sep 1 19:34:33 UTC 2020


i want to do this in nginx

Options All -Indexes
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] 


when converting it as it appears in several forums it gives me this script

user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;








events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request"
'
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;
	
	autoindex off;

	autoindex off;

	location / {
		if (!-e $request_filename){
		rewrite ^(.*)$ index.php?url=$1 break;
		}
	}
	
	

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;
	
    include "C:/laragon/etc/nginx/php_upstream.conf";
    include "C:/laragon/etc/nginx/sites-enabled/*.conf";
    client_max_body_size 2000M;
	server_names_hash_bucket_size 64;
	
	
	

	
}
 

DOES NOT START NGIX AND I GET THE FOLLOWING ERROR

SERVICE NGINX CANNOT START RASON :

NGINX EMERG LOCATION IS NOT ALLOWED HERE IN
C.\LARAGON\BIN\NGINX\NGINX1.14.0/CONF/NGINX.CONF:37

HELPPPP ME PLEASE

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,289276,289276#msg-289276



More information about the nginx mailing list