From 0d7e5c4dd8bbe4c30947bd67b5176013d94b0808 Mon Sep 17 00:00:00 2001 From: Phantom Date: Thu, 15 Mar 2018 15:34:26 +0300 Subject: [PATCH 1/2] Add apache 2 Configuration --- .../sites-available/http-tftpboot.conf | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 etc/apache2/sites-available/http-tftpboot.conf diff --git a/etc/apache2/sites-available/http-tftpboot.conf b/etc/apache2/sites-available/http-tftpboot.conf new file mode 100644 index 0000000..1eb9d32 --- /dev/null +++ b/etc/apache2/sites-available/http-tftpboot.conf @@ -0,0 +1,27 @@ +# +# ---------------- Apache 2 ( httpd ) Configuration to support the starting load of the cisco phones via HTTP. +Listen 6970 +NameVirtualHost *:6970 + + DocumentRoot "/tftpboot" +# DocumentRoot "/data/development/sccp/sources/tftp/tftpboot" +# server_name default + ErrorLog /var/log/httpd/tftp.error.log + CustomLog /var/log/httpd/tftp.access.log combined +# Other directives here + + RewriteEngine on + RewriteBase "/" + RewriteCond "/tftpboot/%{REQUEST_FILENAME}" !-f + RewriteCond "/tftpboot/%{REQUEST_FILENAME}" !-d + RewriteRule "(.*)" "index.php?id=$1" [PT,QSA] + +# +# RewriteEngine on +# RewriteBase "/" +# RewriteCond "/data/development/sccp/sources/tftp/tftpboot/%{REQUEST_FILENAME}" !-f +# RewriteCond "/data/development/sccp/sources/tftp/tftpboot/%{REQUEST_FILENAME}" !-d +# RewriteRule "(.*)" "index.php?id=$1" [PT,QSA] +# + + From ea463ff5eea0db997ba25fb726024304262cee23 Mon Sep 17 00:00:00 2001 From: Phantom Date: Thu, 15 Mar 2018 17:05:48 +0300 Subject: [PATCH 2/2] Add nginx Configuration Script Update. --- etc/nginx/sites-available/nginx-tftpboot.conf | 51 +++++++++++++++++++ tftpboot/index.php | 8 ++- 2 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 etc/nginx/sites-available/nginx-tftpboot.conf diff --git a/etc/nginx/sites-available/nginx-tftpboot.conf b/etc/nginx/sites-available/nginx-tftpboot.conf new file mode 100644 index 0000000..0a2f218 --- /dev/null +++ b/etc/nginx/sites-available/nginx-tftpboot.conf @@ -0,0 +1,51 @@ +# +# Nginx Configuration to support the starting load of the Cisco phones via HTTP +# +# "Php-fpm" installation and configuration is required. +# +# +# +server { + listen 6970; + server_name tftp.servername.org; + #root /tftpboot; + root /tftpboot; + + # Normal Logging + #access_log /var/log/nginx/tftp.access.log; + #error_log /var/log/nginx/tftp.error.log; + + # Debug Rewrite Rules + rewrite_log on; + access_log /var/log/nginx/tftp.access.log; + error_log /var/log/nginx/tftp.error.log notice; + + index index.php; + + location / { + #rewrite ^([^.]*[^/])$ $1/ permanent; + #try_files $uri $uri/ /index.php?id=$query_string; + rewrite ^/(.*)$ /index.php?id=$1 last; + } + + location ~ \.php$ { + proxy_read_timeout 61; + fastcgi_read_timeout 61; + try_files $uri $uri/ =404; + fastcgi_pass unix:/var/run/php-fpm.sock; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + } + # Deny access to .htaccess + location ~ /\.ht { + deny all; + } + + error_page 404 /; + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } +} diff --git a/tftpboot/index.php b/tftpboot/index.php index c543e9c..ad3df0a 100644 --- a/tftpboot/index.php +++ b/tftpboot/index.php @@ -37,8 +37,12 @@ if (empty($path['languages'])) {$path['languages'] = $path['tftp']. '/locales/la if (empty($path['deflanguages'])) {$path['deflanguages'] = $path['languages']. '/English_United_States';} $locale_list = array('-dictionary.', 'dictionary-ext.', '-dictionary.utf-8.', '-kate.xml', '-font.xml', '-font.dat','-tones.xml', 'be-sccp.jar', 'tc-sccp.jar', 'td-sccp.jar', 'ipc-sccp.jar', 'mk-sccp.jar', '_locale.loads', 'i-button-help.xml'); - -print_r($path); +if ($print_debug == 'on') { + print_r('
Init Pach:
'); + print_r($path); + print_r('
Request:
'); + print_r($request); +} $req_file_full_path = '' ; if (!empty($req_file)) {