[TUTORIAL] How to edit your apache.conf file

Post your questions about Web Server usage and Apache + PHP + MySQL/SQLite web applications.
GeekMan
Starting out
Posts: 32
Joined: Wed Dec 23, 2009 11:19 am

Re: [TUTORIAL] How to edit your apache.conf file

Post by GeekMan »

Hey all,
Thank you to thorejoha for the excellent tutorial! However, while this tutorial is very good, it is still a little confusing for the average user (like myself) who may not be familiar with using ftp clients, editing .conf files or accessing root directories. In the hopes of helping those who need this info in the future I'm going to add a few of my thoughts to this thread that will hopefully clarify things and bring the information contained here up to date for the new administration panel layout.

First thing you need to know is that by accessing the root directory of your QNap device you will have the power to FUBAR your NAS by editing or even deleting a file or folder that your unit needs in order to run. Please be careful and make backups of any and all files you are editing just in case something goes wrong. With that said, let's get started.

OK, let's set up your QNap device.
  • Log in to your QNap's "Administration" page.
  • On the left hand navigation panel, go to "Network Services" and then "FTP Service"
  • Check the "Enable FTP Service" checkbox. The protocol type should be "FTP (standard)" and the port number should be "21".
  • Apply the changes if necessary.
  • Next, on the left hand navigation panel, go to "Network Services" and then "Telnet/SSH"
  • Check the box "Allow SSH conection" and make sure the port number is "22"
  • Apply the changes if necessary.
Next we need to download, install and open an FTP program. I'm using Filezilla, but any FTP program will have the same basic routine for connecting to the NAS.
  • Open Filezilla.
  • Go to File|Site Manager
  • Create a new site and name it.
  • Fill in the following fields:
    • Host: Your NAS IP Address
    • Port: 22
    • Server Type: SFTP - SSH File Transfer Protocol
    • Logon Type: Normal
    • User: your admin name
    • Password: Your admin password
    • (Here's a screenshot that graphically explains the above)
      Image
  • Click OK to save the new site
Now connect to the site and you will see some files and folders, however this is NOT the root. You need to click the little folder icon at the top of the remote site window that has the two dots next to it to get to the root. Once you reach the root directory you'll see folders for
~~~~~~~~~~~~~~~~~~~~~~~~
GeekMan
Just another moron with a keyboard.
~~~~~~~~~~~~~~~~~~~~~~~~
Pieter_
New here
Posts: 7
Joined: Tue Feb 02, 2010 9:07 pm

Re: [TUTORIAL] How to edit your apache.conf file

Post by Pieter_ »

thorejoha wrote:-
-
[*]Image
Please follow the link to se the picture in full size.
-
Warning Take bacup of your file before editing it.
-
Open the the File apache.config, and do the editing.
I have marked the button for saving changes.
Press this button after editing, and then close the file.
-
Hello,

Thank you for this tut! Almost helpful for me, because I do have also the warning from Apache.
I do not know what I have to edit. Do you mean not making any changes and save it?

Thanks in advance!

Best regards,
Pieter
Pieter_
New here
Posts: 7
Joined: Tue Feb 02, 2010 9:07 pm

Re: [TUTORIAL] How to edit your apache.conf file

Post by Pieter_ »

Anyone who can help me on this?
Relaunch Warning... What and where I have to edit ? Check above message please

Pieter
hornetbzz
Getting the hang of things
Posts: 97
Joined: Tue Apr 07, 2009 8:10 am

Re: [TUTORIAL] How to edit your apache.conf file

Post by hornetbzz »

Hi,

The file to edit for this "exercise" is the Apache configuration file. This is to be duplicated (ie copied and renamed changing the extension for example) before modifying as you could introduce mistake so you shall be able to turn back to the original configuration. File Name and Path (mnt/HDA_ROOT/apache/conf/apache.conf) are on the top of the above picture but I guess the file location depends on your system. To be honnest, the 1st important point is to connect ssh and once done (so Putty if you've a window machine to access your NAS), then with winscp or whatsoever, not the reverse. But you can follow that process to connect with Winscp which embeds also Putty (so you'll be able to connect ssh anyway). Take note that you'll do nothing without command line interface (CLI), so you shall take care of it quicker or sooner, when succeded with Winscp. That will be your next step.

In that case you're mentionning, the error you get has nothing to do with an Apache error but a server error.
I suggest you to :
- check the Winscp interface configuration as per the tuto description,
- check again that all the right doors (ie IP/port) are open on the way inbetween your PC and your Qnap. That's with an high probably the issue you're facing. (firewall blocking ports, uncorrect NAT or PAT...)

If you have Apache errors, which is a different matter :
Then you may tell what Apache error you get, from the server prospective (ie your logs) and from the client prospective (ie your browser debugger).
The apache logs are the access and error logs, if you do not know how to find them, just connect ssh to your qnap and launch the CLI: find -name "*access.log"

Hope it helps
The Force to be with you !!
--------------------------------------
TS509 Pro (2.1.5 Build 0408T), Apache/2.2.6 (Unix) DAV/2 mod_ssl/2.2.6 OpenSSL/0.9.8e , PHP 5.2.9, 5 x 1.5 To (RAID5), 1 nux Firewall, 1 Netgear GS724T, 3 other machines (Debian)
Pieter_
New here
Posts: 7
Joined: Tue Feb 02, 2010 9:07 pm

Re: [TUTORIAL] How to edit your apache.conf file

Post by Pieter_ »

hornetbzz wrote:Hi,

[edit]

Hope it helps
I guess it helped! I do not get any more Apache Relaunch warnings anymore!
But, i have to say, it's difficult to understand the whole message, because I'm not familiar with it and there is maybe also a difficulty in language to understand it.
Anyhow, thank you for you're help

Regards,
Pieter
rocksparow
New here
Posts: 2
Joined: Fri Jul 09, 2010 2:12 am

Re: [TUTORIAL] How to edit your apache.conf file

Post by rocksparow »

For Apache configuration file. This is to be duplicated (ie copied and renamed changing the extension for example) before modifying as you could introduce mistake so you shall be able to turn back to the original configuration. File Name and Path (mnt/HDA_ROOT/apache/conf/apache.conf) on these way the location can depend on them.
User avatar
DavidKundalini
Starting out
Posts: 10
Joined: Thu Aug 26, 2010 6:10 pm

Re: [TUTORIAL] How to edit your apache.conf file

Post by DavidKundalini »

I have this problem:

On my QNAP TS-210:
path /mnt/HDA_ROOT/apache/conf/apache.conf does not seem to exist
Instead i can access /mnt/HDA_ROOT/.config/apache.conf.

But, every change i make to this file (e.g.: user and group) disappears as soon as I restart the server...
QNAP TS-210, ASUS laptop F7se, HP j4580
User avatar
DavidKundalini
Starting out
Posts: 10
Joined: Thu Aug 26, 2010 6:10 pm

Re: [TUTORIAL] How to edit your apache.conf file

Post by DavidKundalini »

Solved the problem by adding an include at the bottom of
/etc/config/apache/apache.conf.
The include refers to another configuration file containing
the user to start apache with, the extra modules to load, etc.

Qhttpd.sh seems to rewrite anyway some of the lines in apache.conf,
but the include is preserved. So the configuration properties
in the second file are properly set on apache restart.
QNAP TS-210, ASUS laptop F7se, HP j4580
User avatar
DavidKundalini
Starting out
Posts: 10
Joined: Thu Aug 26, 2010 6:10 pm

Re: [TUTORIAL] How to edit your apache.conf file

Post by DavidKundalini »

...even if the solution before causes an "Apache process restarted" warning every time I power on my NAS... :|
QNAP TS-210, ASUS laptop F7se, HP j4580
hornetbzz
Getting the hang of things
Posts: 97
Joined: Tue Apr 07, 2009 8:10 am

Re: [TUTORIAL] How to edit your apache.conf file

Post by hornetbzz »

Hi,

I guess you should look at this great tutorial as well as these wiki pages :

Modify apache.conf

Running Your Own Application at Startup

You will get rid of these issues then. Follow step by step doing your best researches to understand what you're doing.
The Force to be with you !!
--------------------------------------
TS509 Pro (2.1.5 Build 0408T), Apache/2.2.6 (Unix) DAV/2 mod_ssl/2.2.6 OpenSSL/0.9.8e , PHP 5.2.9, 5 x 1.5 To (RAID5), 1 nux Firewall, 1 Netgear GS724T, 3 other machines (Debian)
User avatar
DavidKundalini
Starting out
Posts: 10
Joined: Thu Aug 26, 2010 6:10 pm

Re: [TUTORIAL] How to edit your apache.conf file

Post by DavidKundalini »

I tried the solution proposed in the tutorial and everything works fine
except for the user and usergroup which are resetted to httpduser/everyone
every time I restart the server with the script Qhttpd.sh.

The only way I've found for making it work is with the include at the end
of apache.conf. But this causes the process restart warning I described
before...

Maybe the script contains some command to reset those info inside apache.conf
but I still cannot find it...
QNAP TS-210, ASUS laptop F7se, HP j4580
leohart_faifai
Starting out
Posts: 30
Joined: Sun Feb 15, 2009 5:40 pm

Re: [TUTORIAL] How to edit your apache.conf file

Post by leohart_faifai »

Can you please tell if TS-101 having the same problem???
How can I allow SSH port 22???

Thank you
ellirael
New here
Posts: 8
Joined: Sat Jun 28, 2014 1:22 am

Re: [TUTORIAL] How to edit your apache.conf file

Post by ellirael »

This info is outdated since 4.1.0 fm release. Qhttpd.sh rewrites all changes in apache conf files.
Blisk
Know my way around
Posts: 143
Joined: Fri Jul 08, 2011 5:54 am

Re: [TUTORIAL] How to edit your apache.conf file

Post by Blisk »

How can I change default web admin site to joomla.
When I put in browser my IP so it doesn't open admin web site, but directly joomla?
User avatar
pwilson
Guru
Posts: 22533
Joined: Fri Mar 06, 2009 11:20 am
Location: Victoria, BC, Canada (UTC-08:00)

Re: [TUTORIAL] How to edit your apache.conf file

Post by pwilson »

Blisk wrote:How can I change default web admin site to joomla.
When I put in browser my IP so it doesn't open admin web site, but directly joomla?
Image

There is no need to edit your apache.conf file at all.

If you want to stop the redirection to your Admin site, simply delete/rename your /share/Web/index.php file to another name.

Code: Select all

mv /share/Web/index.php /share/Web/index.php.REDIRECT
mv /share/Qweb/index.php /share/Qweb/index.php.REDIRECT

One of these commands will work. The other will fail. Run both and it will solve your problem.

Personally I changed my /share/Web/index.php to the following content:

Code: Select all

<?php
echo "<img src=\"http://i59.tinypic.com/kd28si.jpg\" border=0>";
?>
This produces the following output when curious people hit my Webserver:

Image

I do this for the benefit of hackers and my ISP's security team when they note that my Port 80 is "open". :P

I use QNAP's Virtual Host feature so that connections to:

http://xxx.xxx.xxx.xxx/ gets the above output. Meanwhile....
http://XXXXXX.myqnapcloud.com/ gets to my phpBB3 Forum's system, and
http://XXXXXX.dyndns.org/ gets to my Wordpress system.

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.
Locked

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