apache.conf gets overwritten after fw update to 4.1.0

Post your questions about Web Server usage and Apache + PHP + MySQL/SQLite web applications.
User avatar
mightymads
Starting out
Posts: 14
Joined: Thu May 21, 2009 4:41 pm
Location: Holbaek, Denmark

Re: apache.conf gets overwritten after fw update to 4.1

Post by mightymads »

Thanks pwilson, I'm using your suggested workaround and it does the trick for me.

/mightymads
raphzahn
New here
Posts: 5
Joined: Mon Nov 14, 2011 4:39 am
Location: southern, Germany

Re: apache.conf gets overwritten after fw update to 4.1

Post by raphzahn »

Hi,

still no update? Grrrrr

my little workaround is also a script to replace my configfiles an restart the apache without the init script...
http://raphaelwolfer.de/media/apache.sh

i use this script instead of the init script. It is called in a qpkg startup script which needs some settings in the Apache configuration...
On reboot the apache configs are recovered from the system. On the end of the startup the qpkgs are starting up. In one of these startupscripts
i'm calling my apache.sh instead of /etc/init.de/Qthttpd.sh ...

I opened an ticket in the Qnap bug tracker but i don't know if they pay attention to it...
User avatar
pwilson
Guru
Posts: 22533
Joined: Fri Mar 06, 2009 11:20 am
Location: Victoria, BC, Canada (UTC-08:00)

Re: apache.conf gets overwritten after fw update to 4.1

Post by pwilson »

raphzahn wrote:Hi,

still no update? Grrrrr

my little workaround is also a script to replace my configfiles an restart the apache without the init script...
http://raphaelwolfer.de/media/apache.sh

i use this script instead of the init script. It is called in a qpkg startup script which needs some settings in the Apache configuration...
On reboot the apache configs are recovered from the system. On the end of the startup the qpkgs are starting up. In one of these startupscripts
i'm calling my apache.sh instead of /etc/init.de/Qthttpd.sh ...

I opened an ticket in the Qnap bug tracker but i don't know if they pay attention to it...
Bad idea. That script does not setup the SSL Proxy, etc.

Do yourself a favour, use the one QNAP provided, and use mine affterwards in order to integrate your custom file into the "standard" QNAP Apache configuration.
That script you provided creates more issues than it resolves.

You can run my script as often as you want.

Patrick M. Wilson
Victoria, BC Canada
QNAP TS-470 Pro w/ 4 * Western Digital WD30EFRX WD Reds (RAID5) - - Single 8.1TB Storage Pool FW: QTS 4.2.0 Build 20151023 - Kali Linux v1.06 (64bit)
Forums: View My Profile - Search My Posts - View My Photo - View My Location - Top Community Posters
QNAP: Turbo NAS User Manual - QNAP Wiki - QNAP Tutorials - QNAP FAQs

Please review: When you're asking a question, please include the following.
raphzahn
New here
Posts: 5
Joined: Mon Nov 14, 2011 4:39 am
Location: southern, Germany

Re: apache.conf gets overwritten after fw update to 4.1

Post by raphzahn »

Bad idea. That script does not setup the SSL Proxy, etc.

Do yourself a favour, use the one QNAP provided, and use mine affterwards in order to integrate your custom file into the "standard" QNAP Apache configuration.
That script you provided creates more issues than it resolves.

You can run my script as often as you want.
Hi there,

i don't think that it's a bad idea. indeed its a hack but its working for me without errors. What issues do you expect? SSl, WebDAV, user Auth and Subversion is working fine.
Its nearly the same as you do except that you add an Include and I overwrite the recovered default configs with my own config including custom includes ;)...
... and I exaclty know what config is currently running because it will be never changed by some sort of firmeware update or file recovery (they are in a share folder as you can see in the script).

My script has also more bells and whistles. For example it checks if the apache is running so the restart works. It shows the result of apachectl restart in Qnap Syslog...

But may be you can clarify some things to me. I'm not very familiar with apache config. Is it possible with your way (adding an custom.conf as include) to overwrite already present settings like the Listening port, ServerName and so on?
In my Qnap these settings will be recovered on every boot time to defaults. That is the major problem for which i've written this apache.sh.
User avatar
pwilson
Guru
Posts: 22533
Joined: Fri Mar 06, 2009 11:20 am
Location: Victoria, BC, Canada (UTC-08:00)

Re: apache.conf gets overwritten after fw update to 4.1

Post by pwilson »

raphzahn wrote:But may be you can clarify some things to me. I'm not very familiar with apache config. Is it possible with your way (adding an custom.conf as include) to overwrite already present settings like the Listening port, ServerName and so on?


Of course, you can change "any" setting. It will "remember" the last option it finds if you have the same option listed in multiple files. (You'll note the "Include" directives are at the bottom of the apache.conf file).
raphzahn wrote:In my Qnap these settings will be recovered on every boot time to defaults. That is the major problem for which i've written this apache.sh.
Build your custom file, and use my script to add it to your running Apache server. You can add my commands to your "autorun.sh" file, so that it runs every time you start your NAS. (The next Firmware is expected to be released in mid-september, so hopefully this nasty hack will no longer be required thereafter).

You will probably need to change the location of the custom configuration on your filesystem

Patrick M. Wilson
Victoria, BC Canada
QNAP TS-470 Pro w/ 4 * Western Digital WD30EFRX WD Reds (RAID5) - - Single 8.1TB Storage Pool FW: QTS 4.2.0 Build 20151023 - Kali Linux v1.06 (64bit)
Forums: View My Profile - Search My Posts - View My Photo - View My Location - Top Community Posters
QNAP: Turbo NAS User Manual - QNAP Wiki - QNAP Tutorials - QNAP FAQs

Please review: When you're asking a question, please include the following.
qdr
New here
Posts: 3
Joined: Tue Jan 01, 2013 9:55 pm

Re: apache.conf gets overwritten after fw update to 4.1

Post by qdr »

Guys, i've got a small problem:
I used P. M. Wilson's script file to Include customized.conf, and it works, at least half of it works. Here is what i'm trying to do:
1. I have another server with joomla and I want/have to use qnap as reverse proxy for it because of the myqnapcloud dyndns service.
2. I want to reverse proxy transmission to host/transmission for convenience.

I managed to accomplish both tasks before the 4.1 update and now I can't remember how I did it.

So the problem is - when I try to include my customized.conf:

Code: Select all

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so


NameVirtualHost *:80

<VirtualHost *:80>
ProxyRequests Off
    <Proxy *>
        Order Allow,Deny
        Allow from all
    </Proxy>
  # Forward all requests for / to joomla
  ProxyPass / http://jml.cx/
  ProxyPassReverse / http://jml.cx/

       # Make pictures, scripts and styling client-cacheable
     <IfModule expires_module>
        ExpiresActive On
        ExpiresByType image/gif A43200
        ExpiresByType image/png A43200
        ExpiresByType application/javascript A43200
        ExpiresByType text/css A43200
     </IfModule>

</VirtualHost>

<VirtualHost *:80>
ProxyRequests Off
    <Proxy *>
        Order Allow,Deny
        Allow from all
    </Proxy>

RewriteRule /transmission[/]?$ /transmission/web [R=permanent]
ProxyPass /transmission http://127.0.0.1:9091/transmission
ProxyPassReverse /transmission http://127.0.0.1:9091/transmission

<Location /transmission>

   Order Allow,Deny
   Allow from All

   # Make pictures, scripts and styling client-cacheable
   <IfModule expires_module>
      ExpiresActive On
      ExpiresByType image/gif A43200
      ExpiresByType image/png A43200
      ExpiresByType application/javascript A43200
      ExpiresByType text/css A43200
   </IfModule>

</Location>

</VirtualHost>
When I restart the Apache with Mr. Wilson's script I only get the first virtual host working, which means that going to NAS localhost will redirect you to jml.cx (jml.cx was added to etc/hosts). But when i try to access localhost/tranmission, I get a 404 error, because it redirects localhost/transmission to jml.cx/transmission, which it shouldn't do. Can anyone tell me what I'm missing here?
User avatar
schumaku
Guru
Posts: 43579
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: apache.conf gets overwritten after fw update to 4.1

Post by schumaku »

<VirtualHost *:80> sections without any ServerName for example?
raphzahn
New here
Posts: 5
Joined: Mon Nov 14, 2011 4:39 am
Location: southern, Germany

Re: apache.conf gets overwritten after fw update to 4.1

Post by raphzahn »

pwilson wrote:
raphzahn wrote: Build your custom file, and use my script to add it to your running Apache server. You can add my commands to your "autorun.sh" file, so that it runs every time you start your NAS. (The next Firmware is expected to be released in mid-september, so hopefully this nasty hack will no longer be required thereafter).
ok, you are right. there is no need to over write the configs... but for now its working.
If they don't releas an update with a fixed apache i will think about to change my script.
raphzahn
New here
Posts: 5
Joined: Mon Nov 14, 2011 4:39 am
Location: southern, Germany

Re: apache.conf gets overwritten after fw update to 4.1

Post by raphzahn »

@pwilson:
Okay, long story short. It seems to me that your solution is not working in every case.

for example Settings in apache-dav.conf are wrong and they won't get overwritten by includes loaded after the original include of this file...

so i will stick to my solution with configuring and overwriting until i need a better solution.

anyway thx for your efforts
gheinert
New here
Posts: 3
Joined: Wed Feb 12, 2014 6:23 pm

Re: apache.conf gets overwritten after fw update to 4.1

Post by gheinert »

Dear Patrick,

Thanks for the post. It works fine for me!

Best wishes

Gideon
User avatar
schumaku
Guru
Posts: 43579
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: apache.conf gets overwritten after fw update to 4.1.0

Post by schumaku »

Already tried QTS 4.1.1 ? Unless I'm wrong, this issue is history again.
User avatar
kasper58
Starting out
Posts: 26
Joined: Wed Jul 20, 2011 2:41 am
Location: Huntly, New Zealand

Re: apache.conf gets overwritten after fw update to 4.1.0

Post by kasper58 »

@schumaku

Not sure if issue is fixed. This use to work before v4.x, when added to the apache.conf
It is still overwritten when apache restarts.

Code: Select all

#
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule headers_module modules/mod_headers.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadFile /usr/lib/libxml2.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule rewrite_module libexec/mod_rewrite.so
# LoadModule xml2enc_module modules/mod_xml2enc.so
#
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow Override All
Allow from all
</Proxy>
ProxyPass /sighthound/ http://192.168.10.100:8210/
ProxyPassReverse /sighthound/ http://192.168.10.100:8210/
ProxyPass /ipcam1/ http://192.168.10.241:80/
ProxyPassReverse /ipcam1/ http://192.168.10.241:80/
ProxyPass /ipcam2/ http://192.168.10.242:80/
ProxyPassReverse /ipcam2/ http://192.168.10.242:80/
ProxyPass /ipcam3/ http://192.168.10.243:80/
ProxyPassReverse /ipcam3/ http://192.168.10.243:80/
ProxyPass /ipcam4/ http://192.168.10.244:80/
ProxyPassReverse /ipcam4/ http://192.168.10.244:80/
ProxyPass /dm800/ http://192.168.10.235:80/
ProxyPassReverse /dm800/ http://192.168.10.235:80/
ProxyPass /oscam/ http://192.168.10.250:8082/
ProxyPassReverse /oscam/ http://192.168.10.250:8082/
ProxyPass /weather/ http://192.168.10.253/Web/weather:80/
ProxyPassReverse /weather/ http://192.168.10.253/Web/weather:80/
ProxyPass /nas/ http://localhost:8003/
ProxyPassReverse /nas/ http://localhost:8003/
ProxyPass /multimedia/ http://localhost/multimedia/
ProxyPassReverse /multimedia/ http://localhost/multimedia/
ProxyPass /router/ http://192.168.10.254:8080/
ProxyPassReverse /router/ http://192.168.10.254:8080/
#
No such thing as a DUMB question.
Just Dumb answers.....
User avatar
doktornotor
Ask me anything
Posts: 7472
Joined: Tue Apr 24, 2012 5:44 am

Re: apache.conf gets overwritten after fw update to 4.1.0

Post by doktornotor »

kasper58 wrote:@schumaku

Not sure if issue is fixed. This use to work before v4.x, when added to the apache.conf
It is still overwritten when apache restarts.
Sorry, but adding sh*ttons of custom stuff in random places never worked AFAICT. You should simply include your custom configuration file.
I'm gone from this forum till QNAP stop wasting volunteers' time. Get help from QNAP helpdesk instead.
Warning: offensive signature and materials damaging QNAP reputation follow:
QNAP's FW security issues
QNAP's hardware compatibility list madness
QNAP's new logo competition
Dear QNAP, kindly fire your clueless incompetent forum "admin" And while at it, don't forget the webmaster!
User avatar
schumaku
Guru
Posts: 43579
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: apache.conf gets overwritten after fw update to 4.1

Post by schumaku »

Some quick testing (no, I'm not QNAP) showed the possibility to add empty lines, comments, and the like around the trailing include file lines. Not spent time if more can be tuned without being overwritten. Looks like fixed to me with QTS 4.1.1 ...
pwilson wrote:Can't you simply create a Virtual Host for your Subversion server?
QNAP should do this for their own Stations still left over on apache (and requiring the environment), and hide it away from the main server. But that's another story.
Locked

Return to “Web Server & Applications (Apache + PHP + MySQL / SQLite)”