1
19.7 Legacy Series / Convert lighttpd to nginx in Opnsense
« on: June 11, 2019, 12:50:52 pm »
I want to change lighttpd to nginx as default web server. I have already installed and changed configuration in nginx server like lighttpd but api and ui routing is not working.
Here is my changed code for nginx configuration
After changing config api response is
Can you please help.It is needed to change web server .
Here is my changed code for nginx configuration
Code: [Select]
server {
listen 80;
server_name _;
root /usr/local/www;
index index.php index.html;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
location /ui/{
alias /usr/local/opnsense/www/;
try_files $uri $uri/ /ui//ui/index.php?_url=$uri&$args;
location ~ /ui/.+\.php$ {
include fastcgi_params;
fastcgi_buffers 256 4k;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
}
}
location /api/{
alias /usr/local/opnsense/www/;
try_files $uri $uri/ /api//api/api.php?_url=$uri&$args;
location ~ /api/.+\.php$ {
include fastcgi_params;
fastcgi_buffers 256 4k;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
}
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
After changing config api response is
Code: [Select]
{
"message": "controller OPNsense\\Core\\Api\\IndexController not found",
"status": 400
}
I have added IndexController though this controller was not in opnsense but it is not working at all.Can you please help.It is needed to change web server .