[TUTORIAL] How to edit your apache.conf file

Post your questions about Web Server usage and Apache + PHP + MySQL/SQLite web applications.
User avatar
thorejoha
Know my way around
Posts: 144
Joined: Mon Mar 24, 2008 9:41 pm

[TUTORIAL] How to edit your apache.conf file

Post by thorejoha » Fri Jan 23, 2009 5:04 pm

Hello

I see many people have problems with editing the apache.conf, and other files in Qnas
This is how I do the editing.
If you wonder about DRAG AND DROP, you find some notis about this in the bottom of the Tutorial.
This program Is also useful to mod your file and permissions. Use rightclick and properties for permission mod.
This tutorial is in tree parts, and shows some tips "how to use WinSCP"

WARNING: be careful with the files and folders inside your Apacheserver.
If you edit or delete wrong files here, your Qnas will not start again.


Part one: How to backup and edit your apache.conf file

Part two: How to drag and drop files inside or between shares in a hurry.

Part Tree: How to mod your files/folders (Change Permission)

All_files_in_tutorial.zip

-
If you want to do big changes, please read this from Frisbe about customized.conf
viewtopic.php?f=32&t=8207&start=0&hilit=customized.conf#p37579
===========================================================================================
===========================================================================================

PART ONE
  1. First of all you need some software to connect to the Qnas.
    I use WinSCP, and this tutorial show how to use this.
    -
    Please download and install WinSCP
    You can find this at http://winscp.net/eng/index.php
    At this moment the newest version is 4.1.8
    -
    -
    -
  2. Enable FTP on your Qnas (http://yournasip or http://yournasip:8080)
    Network Settings --> FTP Service --> Enable FTP Service
    -
    -
    -
  3. Start the program Win SCP
    This window will come up.
    Or maybe you se the next picture. The go to next point.
  4. Image
    Please follow the link to se the picture.
    -
    Press the button New an the next window shows.
    I have already saved two Qnas servers on my WinSCP
    -
    -
    -
  5. Image
    Here you see the login window
    Please enter your hostname, Username and password
    Hostname is your local IPadress
    If you want, you can press save, and make it easyer next time.
    Press Login, and your session starts.
    If you have some problems now, please control your password, port, hostname and username.
    If everything works fine now, a filebrowser will open.
    Please see next pictures
    -
    -
    -
  6. Image
    -
    Here you see the filebrowser. It looks almost the same as an windows filebrowser.
    On the left side it`s your local files and catalogs.
    On the right side it`s the files, folders and shares on the Qnas you logged in to.
    If you want to change the browser for easy drag and drop,
    please read the note about drag and drop in the bottom of this tutorial.
    -
    -
    -
  7. Image
    -
    Everytime people say where to find some files they start from ROOT.
    Use this until you now where to find your files, and your catalogstructure on the Qnas better.
    Here I have marked the two places you need I think.
    On the left side is the button too start terminal window
    This you will use too restart the server, and some other things.
    On the right side is the button, if you want too go too the ROOT of your Qnas.
    -
    -
    -
  8. Image
    Please follow the link to se the picture.
    -
    Press the ROOT button, and you will see the structure in bottom of your QNAS.
    If you will find your apache.conf follow this way
    Open folders MNT -> HDA_ROOT -> .config
    Then you will see these window with some files.
    -
    -
    -
  9. IMPORTANT! First we take backup of the file you want to edit.
    Rightclick on the the file you want to backup.
    duplicate_file001.jpg

    Choose Duplicat in the menu
    -
    This menu box open!
    duplicate_file002.jpg

    -
    Choose to change the name.
    I like to change the name to backup_apache.conf (It must be a different name from the other files!).
    Then Its easy to find back the backupfile.
    Here you se I have change the name
    duplicate_file003.jpg

    Then I press OK and WInSCP makes the copy in same directory.
    If you want, you can also make your own directory for backupfiles.
    -
    -
    -
  10. 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.
    -
    -
    -
  11. Now its time too start the terminal window in WinSCP for restart of your server.
    Press the button for start terminal or press CTRL +T
    Then this window pops up
    If you have one message popping up, and it says, "start new session" press yes.
    Image
    Please follow the link to se the picture in full size.
    -
    In the terminal line you type this command an press enter

    /etc/init.d/./Qthttpd.sh restart

    Then you see the apacheserver restarts. I only takes a couple of seconds.
    After the restart, please close the terminal window, and close WinSCP
    If you are afraid to do this, you can restart the QNas server in normal way in the adminpanel.
    Just find the button restart under System Tools. This will be the same but takes more time
    -
    -
    -
  12. I hope this will help you editing your files in the Qnas.
    If you later have problems with writeaccess and thing like that, I think its the easyest way to do the write-mod with this program.
    Please be patient, and don`t delete any files.
    Then you wil have som problems starting your server.

===========================================================================================
===========================================================================================

PART TWO
DRAG AND DROP FILES inside of Qnas
Total tutorial of WinSCP viewtopic.php?f=32&t=11329
Note: There is also possible to use Winscp to drag and drop. The easy way to do this, is when you start logging in.
In the left window press Preferenses and make it "explorer like"
winscp_Browser.jpg

Then you will only se the Qnas, but nearly like a windows browser of the files and folders.
It is now easy to drag and drop files from the right window, to a map or another share in the left window.
Please be careful.
drag and drop.jpg


===========================================================================================
===========================================================================================

PART TREE
Cmod files and folder with WinSCP

If you want to easy cmod your files and folders, just open WinSCP,
and right click your mousebutton on the file/folder you want to change permission on.
Choose properties
properties.jpg


Then this box opens, and you can change the permissions you want.
cmod.jpg


Tips: If you have some files you dont see under windows explorer, they maybe have the permission 777
Folders with this permission is visible in Windows explorer, but
Files with this permission is not visible in Windows explorer.
Change the permission to 776 or somthing if you vant them visible.

Warning!
If you delete files with this program, you will have one warning/confirm box.
Please leave the boks like its here, and dont mark the "Never ask me again".
delete_confirm_warning.jpg

This is the only way to stop, if you dont agree to delete something.
There is no recylclebin here. Be careful is my best tips!!! Dont delete anything if you are not 100% safe
Please see my Tutorials in the signatur for other problems/Solutions.

All_files_in_tutorial.zip


tags: how to edit apache.conf, Root directory, configuration, edit php.ini, cmod 777 766 invisible files, Use WinSCP to move files fast between shares, drag and drop files in Qnas, fast moving files, how to edit apace apache conf,
You do not have the required permissions to view the files attached to this post.
Last edited by thorejoha on Sun Apr 04, 2010 9:51 pm, edited 14 times in total.
My Tutorials:
Tutorial:How to config webserver on Qnas!
Tutorial:How to use loginscript and Robocopy
Tutorial:How to set up DynDNS on Qnas!
Tutorial:How to move large files on Qnas!
Tutorial:How to edit apache.conf on Qnas!
Tutorial:How to seed files and folders in Qget
Tutorial:How to fix slow wordpress on Qnas!

See also Don`s How To guide!
And Frisbe`s signatur for more Tips and Tricks!
_______________________________________
NAS nr 1: TS-109 Pro FW: 3.1.0 Build 0708T - 1 x Seagate 500Gb + 1X USB 500GB Qraid
NAS nr 2: TS-109 Pro II FW: 3.1.0 Build 0708T - 1 x Western Digital 1Tb
____________________________________________________________________________

User avatar
fribse
Experience counts
Posts: 2076
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
Contact:

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

Post by fribse » Wed Feb 04, 2009 11:10 pm

I have to recommend stronly against modifying the apache.conf directly.
Create a config file another place, eg. a share where you can easily reach it, and only include an 'include /share/YOURSHARE/example.conf' in the apache.conf.

More examples here: Re: How to create third-level domain / subdomain on a QNAP ?

Other than that, excellent work, oh, and DO remember to search the forum's old posts :-)
Best regards
Fribse

NO, RAID is NOT backup - Use RAID-Certified 24x7 drives for raid
HOWTO's:
Make automatic backup of ALL MySQL databases http://forum.qnap.com/viewtopic.php?f=32&t=15628

NAS-659 Pro II (3 GB Ram), Raid1, Survailance station, local backup destination + NAS-853A (16 GB Ram), Virtualization Station, Plex, iDrive
Network: Fritz!Box 7560 + 24p SG200 + 2x8p SG200 + 8p POE EdgeCore + 300/300 mbit Internet

User avatar
thorejoha
Know my way around
Posts: 144
Joined: Mon Mar 24, 2008 9:41 pm

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

Post by thorejoha » Thu Feb 05, 2009 2:14 am

fribse wrote:I have to recommend stronly against modifying the apache.conf directly.
Create a config file another place, eg. a share where you can easily reach it, and only include an 'include /share/YOURSHARE/example.conf' in the apache.conf.

More examples here:
Re: How to create third-level domain / subdomain on a QNAP ?

Other than that, excellent work, oh, and DO remember to search the forum's old posts :-)



I see you recommend strongly against modifying the Apache.conf directly.
If you see my tutorial its also shows how too use WinSCP
Why I spend hours to make this turtorial: Because when you try to search for the string "how to edit apache.conf" it was not anything directly "How to do it" People also need how to use WinSCP.
I dont think everyone want to make one more apache.conf, if they only want to do the small changes they need to make the webserver running.
Everyone need also no how to use WinSCP if the want to change permission on files and folder.
If you mean there is something wrong with the tutorial, please let me know and I will change it.
But I will not recommend everyone to make another customize.conf. if they dont need it
If one person only want to start a webserver, he can use the tutorial "[HOW TO] How to config your webserver first time"
Then if he need to do some small changes, he can do this with WinSCP.
With this two tutorials it will only take 5-10 min to get a webserver running.
One thing I will recommend, and I will also add it to the Tutorial is "Take backup before editing files".


Have a nice Qnap day!!
My Tutorials:
Tutorial:How to config webserver on Qnas!
Tutorial:How to use loginscript and Robocopy
Tutorial:How to set up DynDNS on Qnas!
Tutorial:How to move large files on Qnas!
Tutorial:How to edit apache.conf on Qnas!
Tutorial:How to seed files and folders in Qget
Tutorial:How to fix slow wordpress on Qnas!

See also Don`s How To guide!
And Frisbe`s signatur for more Tips and Tricks!
_______________________________________
NAS nr 1: TS-109 Pro FW: 3.1.0 Build 0708T - 1 x Seagate 500Gb + 1X USB 500GB Qraid
NAS nr 2: TS-109 Pro II FW: 3.1.0 Build 0708T - 1 x Western Digital 1Tb
____________________________________________________________________________

User avatar
fribse
Experience counts
Posts: 2076
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
Contact:

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

Post by fribse » Thu Feb 05, 2009 4:48 pm

The major benefit of creating an 'add on' config, is that you can place your own directives in a share, so you don't need the WinSCP at all.
A standard good editor like PSPad (NOT notepad :!: ) will do the trick, it's much easier to maintain.
Also, you can override all directives, even the ones set previously in the standard config.

Some updates (though in the time I've had TS-409/509/639 I haven't seen it), might reset the config files, and when you use an 'add on' file, you only need to put in the 'include' statement again, and you are back in business (unless they of course change to another Apache Major version).

But as I said, I think your tutorial is good, I just wish people would use the search function, and built on previous knowledge.
Best regards
Fribse

NO, RAID is NOT backup - Use RAID-Certified 24x7 drives for raid
HOWTO's:
Make automatic backup of ALL MySQL databases http://forum.qnap.com/viewtopic.php?f=32&t=15628

NAS-659 Pro II (3 GB Ram), Raid1, Survailance station, local backup destination + NAS-853A (16 GB Ram), Virtualization Station, Plex, iDrive
Network: Fritz!Box 7560 + 24p SG200 + 2x8p SG200 + 8p POE EdgeCore + 300/300 mbit Internet

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

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

Post by hornetbzz » Fri Apr 24, 2009 11:56 am

Thank you for your time and the clear tutorial. 8)

I installed WinSCP and run a new session with the right parameters, so I access the NAS tree, but ANY APACHE CONFIGURATION FILE :? does appear ..?

I'm sure Apache is running on the NAS as I checked the phpinfo and I posted as well my previous apache website php files in the Qweb directory.. and it works from both LAN and public IP adresses. :)

WHERE ARE THESE :evil: FILES, how to access them ......... ????

Thx in advance :D
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
thorejoha
Know my way around
Posts: 144
Joined: Mon Mar 24, 2008 9:41 pm

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

Post by thorejoha » Fri Apr 24, 2009 3:06 pm

Hello

You will find the files under /mnt/HDA_ROOT/apache/conf

If you are going to do big changes I will recomend you too use one customized.conf to make all the changes in like Frisbe have said many times.

Just add " include /share/Qweb/customized.conf " in the bottom of apache conf.
Then you can create one file named customized.conf in the Qweb directory
This will make it easy too reach the file, and you can add all things like virtual host and more if you need later.
My Tutorials:
Tutorial:How to config webserver on Qnas!
Tutorial:How to use loginscript and Robocopy
Tutorial:How to set up DynDNS on Qnas!
Tutorial:How to move large files on Qnas!
Tutorial:How to edit apache.conf on Qnas!
Tutorial:How to seed files and folders in Qget
Tutorial:How to fix slow wordpress on Qnas!

See also Don`s How To guide!
And Frisbe`s signatur for more Tips and Tricks!
_______________________________________
NAS nr 1: TS-109 Pro FW: 3.1.0 Build 0708T - 1 x Seagate 500Gb + 1X USB 500GB Qraid
NAS nr 2: TS-109 Pro II FW: 3.1.0 Build 0708T - 1 x Western Digital 1Tb
____________________________________________________________________________

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

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

Post by hornetbzz » Sat Apr 25, 2009 4:05 am

Thx for the reply.

The problem is that I can't find and access to /mnt/HDA_ROOT/apache/conf.

This path does not appear in the directory tree.

I have only the activated services (i.e. "Networkrecycle bin", "Public", "Qdownload", "Qmultiomedia", "Qrecording" and "Qweb") under the root path.

I can't see what and where I missed sthg .. :?:
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
thorejoha
Know my way around
Posts: 144
Joined: Mon Mar 24, 2008 9:41 pm

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

Post by thorejoha » Sat Apr 25, 2009 4:18 am

You must use port 22 and SFTP in the WinSCP program!
Have you enabled FTP in the adminpanel for Qnas?
Enable like this with port 21 on the Qnas.
enable_FTP.jpg
You do not have the required permissions to view the files attached to this post.
My Tutorials:
Tutorial:How to config webserver on Qnas!
Tutorial:How to use loginscript and Robocopy
Tutorial:How to set up DynDNS on Qnas!
Tutorial:How to move large files on Qnas!
Tutorial:How to edit apache.conf on Qnas!
Tutorial:How to seed files and folders in Qget
Tutorial:How to fix slow wordpress on Qnas!

See also Don`s How To guide!
And Frisbe`s signatur for more Tips and Tricks!
_______________________________________
NAS nr 1: TS-109 Pro FW: 3.1.0 Build 0708T - 1 x Seagate 500Gb + 1X USB 500GB Qraid
NAS nr 2: TS-109 Pro II FW: 3.1.0 Build 0708T - 1 x Western Digital 1Tb
____________________________________________________________________________

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

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

Post by hornetbzz » Sat Apr 25, 2009 4:42 am

Oups, Thx a lot , now it works much better :mrgreen:

steps :
- enable FTP within the QNAP administration panel (was done)
- install WinScp - in case of windows applications - FireFTP could also work (was done)
- NAT port forward : add redirection to port 22 of the NAS for eventual remote access
- connect to the NAS with WinSCP using S-FTP (I used FTP...that was the missing point)

Thx again
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)

airguard
New here
Posts: 8
Joined: Sun Mar 29, 2009 3:15 am

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

Post by airguard » Thu Jun 11, 2009 4:09 pm

Takk skal du ha for fine guider, jeg har problemer med å få kontakt med serveren min utenfra når jeg er på jobb osv.
mulig jeg kontakter deg senere, skal bare prøve litt til først.

woolstep
New here
Posts: 7
Joined: Tue Dec 22, 2009 5:49 am

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

Post by woolstep » Thu Mar 18, 2010 5:40 am

hornetbzz wrote:Oups, Thx a lot , now it works much better :mrgreen:

steps :
- enable FTP within the QNAP administration panel (was done)
- install WinScp - in case of windows applications - FireFTP could also work (was done)
- NAT port forward : add redirection to port 22 of the NAS for eventual remote access
- connect to the NAS with WinSCP using S-FTP (I used FTP...that was the missing point)

Thx again



Hi
Have enabled FTP on Qnap.
Installed WinSCP

Cannot connect to my TS-409 using S-FTP port 22 -- Getting message <Network Error, Connection refused>

Can connect using FTP on port 21, but I only see some of my shared folders. No sign of any Apache conf file or other files for that matter.

Any help ?

Thanks
woolstep

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 » Thu Mar 18, 2010 6:09 am

Hi

all I can do is explaining a bit more in detail how I did that :

I access my files with WinScp (and with putty included)

so you shall set up Winscp.

Here is what I did set up the access session:

IP host : your NAS local IP address
port number= 22
private key file: none
protocole: SFTP (tag to allow SFTP return : not tagged on)

Of course you shall make sure you can access your NAS LAN from your access machine on your network.

Hope it helps

b/r
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)

woolstep
New here
Posts: 7
Joined: Tue Dec 22, 2009 5:49 am

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

Post by woolstep » Fri Mar 19, 2010 5:05 am

hornetbzz wrote:Hi

all I can do is explaining a bit more in detail how I did that :

I access my files with WinScp (and with putty included)

so you shall set up Winscp.

Here is what I did set up the access session:

IP host : your NAS local IP address
port number= 22
private key file: none
protocole: SFTP (tag to allow SFTP return : not tagged on)

Of course you shall make sure you can access your NAS LAN from your access machine on your network.

Hope it helps

b/r



Thanls b/r but unfortunately No luck.

Followed the tutorials but am still getting "Network Error - Connection Refused"

I've tries using PuTTy but get exactly the same error message trying to connect SFTP to port 22.
In NAS administration I only see the posibility or enabling FTP port 21. How does one enable SFTP on port 22 ???

I can connect via FTP port 21 but I do not see any files in the root directory... ONLY some of my shares are visible.

Need help has I want to edit apache.conf in order to allow more than 1 Web Site on server..

woolstep

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 » Fri Mar 19, 2010 5:31 am

hum... no this has nthg to do with FTP

I guess you shall :

- go with your browser to your NAS admin control panel
- go to System Tools
- select "remote login"
- tag "Allow SSH connection Port" and enter "22" (port 22 shall be allowed by your Network & Firewall settings)

I guess then you're done and you should be able to access with WinSCP
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)

woolstep
New here
Posts: 7
Joined: Tue Dec 22, 2009 5:49 am

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

Post by woolstep » Fri Mar 19, 2010 8:17 pm

Hi hornetbzz

It was that simple :)
OK now, I connect.

Thanks a bunch!
woolsteep

Locked

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