NAS 520 port edit ?

Mindspeed Comcerto 2000 based
Post Reply
marga
Posts: 3
Joined: Thu Apr 19, 2018 11:20 am

NAS 520 port edit ?

Post by marga » Thu Apr 19, 2018 11:24 am

Greeting.
I need help.
I have two nas 326 and 520
I want to change.
https: / / mynasip: 5001 / MyWeb / www /
I want to scratch the address
to
https: // munasip: 5001
or
https: // mynasip: 5010
or
https: // mynasip: 8083
directly opens
i-data / sysvol / www

myipadres: 80 to go to mynasip: 5000 or 5001 or 5010
and opening my page direct ...

not that mynasip:5001/r50984,/desktop,/index.html

I tried to change
etc / service_chone and pkg_service_channel failures
but did not work after the restart returned to its original condition.
That's what I did with WinSCP

Mijzelf
Posts: 6203
Joined: Mon Jun 16, 2008 10:45 am

Re: NAS 520 port edit ?

Post by Mijzelf » Sat Apr 21, 2018 9:58 am

marga wrote:
Thu Apr 19, 2018 11:24 am
I tried to change
etc / service_chone and pkg_service_channel failures
but did not work after the restart returned to its original condition.
The directory /etc/ is on a ramdrive, and so changes won't survive a reboot. On boot the box starts with some default files, which are dynamically exchanged/adapted by the firmware backend.
If you want to change the files, you'll have to write a script which does the work, and let that run at boot. One of the ways to get that script running, is to install 'RandomTools', and put your script in /i-data/sysvol/.PKG/RandomTools/etc/custom_startscripts/

Don't know what you want to achieve, probably it's far easier to install your own webserver using Entware-ng.

marga
Posts: 3
Joined: Thu Apr 19, 2018 11:20 am

Re: NAS 520 port edit ?

Post by marga » Sat Apr 21, 2018 1:51 pm

Okay, I'm much clearer now.
I already installed RandomTools and Entware-ng.
I found the location /i-data/sysvol/.PKG/RandomTools/etc/custom_startscripts/
Do you have an example of a script so that I can reformify it?

I want to https: // NASip: 5001 / MyWeb / www / joomla /
Runs for example https: // NASip: 9999 or https: // NASip: 5010 or https: // NASip: xxxx

Mijzelf
Posts: 6203
Joined: Mon Jun 16, 2008 10:45 am

Re: NAS 520 port edit ?

Post by Mijzelf » Sun Apr 22, 2018 11:09 am

marga wrote:
Sat Apr 21, 2018 1:51 pm
Do you have an example of a script so that I can reformify it?
No. To be honest I'm not that into Apache that I would know how the configuration files should be changed.
If you know, you basically have two options: write a script which performs the edits on the existing configuration, of simply copy an adapted file over the current.

marga
Posts: 3
Joined: Thu Apr 19, 2018 11:20 am

Re: NAS 520 port edit ?

Post by marga » Mon Apr 23, 2018 7:40 am

I just want to change.
Ich möchte ein paar Conversions ändern, ich weiß nicht, wie ich nicht weiß, wo.
Ich weiß ein bisschen über PHP zu Modifoku.
Ich weiß nicht, wie man PHP-Skripte schreibt.

Code: Select all

#WebService Start#
<VirtualHost *:5000>
  AddDefaultCharset off
  RewriteEngine on
RewriteCond %{HTTP_HOST} ^(.*):(.*)$
das
  RewriteRule ^/$ http://%{HTTP_HOST}%{REQUEST_URI}r50984,/desktop,/ [R=301]   
  
  RewriteRule ^/$ http://%{HTTP_HOST}%{REQUEST_URI}MyWeb/www/ [R=301]
  RewriteCond %{HTTP_HOST} !^(.*):(.*)$
  und das
  RewriteRule ^/$ /r50984,/desktop,/ [R=301]
  auf
   RewriteRule ^/$ /MyWeb/www/ [R=301]

  AliasMatch "^(?i)/MyWeb/www(.*)" "/i-data/30ce482e/www$1"
  RewriteCond %{HTTP_HOST} ^(.*):(.*)$
  RewriteRule "^/www(.*)" "http://%{HTTP_HOST}/MyWeb/www$1" [R=301,NC]
  RewriteCond %{HTTP_HOST} !^(.*):(.*)$
  RewriteRule "^/www(.*)" "/MyWeb/www$1" [R=301,NC]
  Alias /MyWeb/template /usr/local/apache/htdocs/desktop,/css/Apache_Indexing_Template
  HeaderName /MyWeb/template/header.html
  ReadmeName /MyWeb/template/footer.html
  AddIcon /MyWeb/template/i_f.gif ^^DIRECTORY^^
  DefaultIcon /MyWeb/template/i_file.gif
  IndexOptions Charset=UTF-8 FancyIndexing FoldersFirst HTMLTable NameWidth=* IconsAreLinks SuppressDescription
  Include /etc/pkg_service_conf/httpd_package2.conf
</VirtualHost>
<Directory "/usr/local/apache/htdocs/desktop,/css/Apache_Indexing_Template">
  Options All
  Allow from all
</Directory>
#Listen 5000
#WebService End#

Mit disem port auch.

<VirtualHost *:5001>
  SSLEngine On
  SSLCertificateFile /etc/service_conf/CA.cer
  SSLCertificateKeyFile /etc/service_conf/CA_key.cer
  SSLProtocol all -SSLv2 -SSLv3
  AddDefaultCharset off
  RewriteEngine on
  RewriteCond %{HTTP_HOST} ^(.*):(.*)$
  das
  RewriteRule ^/$ https://%{HTTP_HOST}%{REQUEST_URI}r50984,/desktop,/ [R=301]
  RewriteRule ^/$ https://%{HTTP_HOST}%{REQUEST_URI}MyWeb/www/
  
   [R=301]
  RewriteCond %{HTTP_HOST} !^(.*):(.*)$
  und das
  RewriteRule ^/$ /r50984,/desktop,/ [R=301]
RewriteRule ^/$ MyWeb/www/ [R=301]

  AliasMatch "^(?i)/MyWeb/www(.*)" "/i-data/30ce482e/www$1"
  RewriteCond %{HTTP_HOST} ^(.*):(.*)$
  RewriteRule "^/www(.*)" "https://%{HTTP_HOST}/MyWeb/www$1" [R=301,NC]
  RewriteCond %{HTTP_HOST} !^(.*):(.*)$
  RewriteRule "^/www(.*)" "/MyWeb/www$1" [R=301,NC]
  Alias /MyWeb/template /usr/local/apache/htdocs/desktop,/css/Apache_Indexing_Template
  HeaderName /MyWeb/template/header.html
  ReadmeName /MyWeb/template/footer.html
  AddIcon /MyWeb/template/i_f.gif ^^DIRECTORY^^
  DefaultIcon /MyWeb/template/i_file.gif
  IndexOptions Charset=UTF-8 FancyIndexing FoldersFirst HTMLTable NameWidth=* IconsAreLinks SuppressDescription
</VirtualHost>
Im Grunde möchte ich nur diese Umleitung ändern
http://NASip:5001
Unsere IP-Adresse ist automatisch umgeleitet.
http://NASip:5001/r50984,/desktop,/
Ich möchte das ändern an
http://NASip:5001/MyWeb/www/

Ich brauche es, weil mein Router von einer öffentlichen IP-Adresse direkt auf die Website überbrückt werden soll.
zum Beispiel Port 80 an Port 5000 und 443 auf 5001 ...
Ich hoffe sei verstehst was ich wirklich will.

Mijzelf
Posts: 6203
Joined: Mon Jun 16, 2008 10:45 am

Re: NAS 520 port edit ?

Post by Mijzelf » Tue Apr 24, 2018 7:44 am

Code: Select all

#!/bin/sh

cat >>/etc/pkg_service_conf/httpd_zld2.conf <<__END__
Listen 8001

<VirtualHost *:8001>
  SSLEngine On
  SSLCertificateFile /etc/service_conf/CA.cer
  SSLCertificateKeyFile /etc/service_conf/CA_key.cer
  SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
  SSLCipherSuite ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDH
E-RSA-AES128-GCM-SHA2
  SSLHonorCipherOrder on
  RewriteEngine on 
  RewriteCond %{HTTP_HOST} ^(.*):(.*)$
  RewriteRule ^/$ https://%{HTTP_HOST}%{REQUEST_URI}MyWeb/www/ [R=301]
  RewriteCond %{HTTP_HOST} !^(.*):(.*)$
  RewriteRule ^/$ MyWeb/www/ [R=301]  
</VirtualHost>
__END__

touch /tmp/restart_httpd
This adds a virtual server on port 8001 to /etc/pkg_service_conf/httpd_zld2.conf, with your rewirte rules. I don't know what all arguments do, just copied the block from the current httpd_zld2.conf.

The 'touch /tmp/restart_httpd tells the package manager the webserver has to be restarted. This only works if your script is (indirectly) executed by the package manager.
If you run the script manually, you'll have to execute '/etc/init.d/pkghttpd.sh restart'.

Post Reply