[HOWTO] How to use .htaccess?

Post your questions about Web Server usage and Apache + PHP + MySQL/SQLite web applications.
dumbledore
Starting out
Posts: 16
Joined: Wed Sep 12, 2007 10:33 pm

[HOWTO] How to use .htaccess?

Post by dumbledore »

Hi there,

i wan´t some password protected directories on my website and try a .htaccess file..

But nothing worked. It seems that the webserver ignored .htaccess files.

How can i protect directories?

Bye, René
JGrob
Starting out
Posts: 22
Joined: Fri Sep 07, 2007 5:26 pm
Location: Germany

Re: How to use .htaccess?

Post by JGrob »

dumbledore wrote:It seems that the webserver ignored .htaccess files
Yes, webserver will ignore .htaccess until you edit
/etc/config/apache/apache.conf

Edit settings in section
(Directory "/share/Qweb")
...
AllowOverride AuthConfig (original: AllowOverride None)
...
(/Directory)

If you also want enable indexing, use "AllowOverride AuthConfig Options"
If you also want enable fancy indexing use "AllowOverride AuthConfig Options Indexes"

Create a suitable .htpasswd file in /Qweb

Use .htaccess like this:
AuthName "protected"
AuthType Basic
AuthUserFile /share/Qweb/.htpasswd
Require valid-user

If you want to enable directory indexing add a line "Options +Indexes"
if you want to enable fancy directory indexing add a line "FancyIndexing On"

greetings
Jochen
Last edited by JGrob on Sun Sep 30, 2007 3:43 am, edited 1 time in total.
User avatar
AndyChuo
Experience counts
Posts: 2388
Joined: Thu Sep 13, 2007 11:56 am
Location: Taipei, Taiwan

Post by AndyChuo »

Thanks for knowledge sharing JGrob.
Curt
New here
Posts: 3
Joined: Wed Sep 12, 2007 10:09 pm

apache.conf

Post by Curt »

Hi!

How do I find and edit the apache.conf file?
Plaease explain for me, I am totally stuck here!
How do I use samba?
My produkt is TS-109, firmware 0831T
Can't see TS-109 in network since upgrade to 0831T...

Great produkt, even better if I get this thing working...

Many tanx if I get an answer /Curt
JGrob
Starting out
Posts: 22
Joined: Fri Sep 07, 2007 5:26 pm
Location: Germany

Re: apache.conf

Post by JGrob »

Curt wrote:How do I find and edit the apache.conf file?
Plaease explain for me, I am totally stuck here!
you will need some basic unix knowledge
use telnet or ssh to connect to NAS
edit apache.conf with vi editor
Curt wrote: How do I use samba?
My produkt is TS-109, firmware 0831T
Can't see TS-109 in network since upgrade to 0831T...
please read this thread:
http://forum.qnap.com/phpbb2/viewtopic.php?t=128

yours,
Jochen Grob
Curt
New here
Posts: 3
Joined: Wed Sep 12, 2007 10:09 pm

Post by Curt »

Thank you for answer, but this is to hard for me...
It would be great if there was an apache.conf like the php.ini to edit from administration-page...

Is it possibly for someone to wrote an short step by step how to do?
Sould I connect to NAS from telnet first, and then run vi from my pc?
I dont understand what command I shell use in vi to get to /etc/config/apache/apache.conf, and then how to edit the file etc etc...

sorry for taking your time.

/Curt
jniekel
Starting out
Posts: 42
Joined: Thu Sep 27, 2007 7:46 pm
Location: Amsterdam

Post by jniekel »

have you succeeded yet, or still trying?

job
kito
First post
Posts: 1
Joined: Fri Sep 28, 2007 11:31 am

example

Post by kito »

Hi,

Another method to modify text files on nas box is to ftp the files to the local pc. Its kind of slow, but its works for me since I dont know vi that well.

Basically copy the file to a shared directory, and then use ftp to download the program to your pc. Edit the file with any text editor, and then ftp the file back to a shared directory, and finally copy the edited file back to the original location.

When using ftp program set the transfer mode to acsii so it will translate the cr/lf properly.
Curt
New here
Posts: 3
Joined: Wed Sep 12, 2007 10:09 pm

Post by Curt »

Hi!

With the new betafirmware 1.1.2 0928T you can now use WinSCP to edit files.
Great, many thanks!

/Curt
jimarsul
Getting the hang of things
Posts: 97
Joined: Mon Sep 17, 2007 4:39 am

Good stuff - Question...

Post by jimarsul »

ok 2 questions 1) is mod_rewrite enabled by default and if not how do I do that? 2) is Mod_proxy enabled by default and ditto...?
Model - TS-209
Firmware version - Most Recent
Vista SP1
HDD1- SAMSUNG HD403LJ CT10
No RAID
Services-FTP, Multimedia, Web Server, MySql
External-None
NAS speed/MTU-100/1500
3 Wordpress Blogs Latest Version
Compression enabled in php.ini
User avatar
TheEnvoy
Know my way around
Posts: 138
Joined: Mon Sep 10, 2007 3:47 pm
Location: Berlin, Germany
Contact:

Post by TheEnvoy »

I guess the situation for the 209 and 109 is the same, so the answers would be: no, not possible, no, not possible

at least for the moment, as QNAP delivers no apache modules

You would need to build them yourself or try to find some that are fitting in (maybe debian arm ones?)

regards
TheEnvoy
Think! :idea: Search :!: Ask :?:

"Those who would give up essential Liberty, to purchase a little temporary
Safety, deserve neither Liberty nor Safety."
-- B. Franklin

// TS-409 Pro - Debian Lenny
// TS-109 Pro / FW: 1.1.1 0831 (offline)
Markovich
Know my way around
Posts: 213
Joined: Wed Sep 19, 2007 11:04 pm
Location: Sunshine Coast, QLD, Australia

Post by Markovich »

jimarsul wrote:ok 2 questions 1) is mod_rewrite enabled by default and if not how do I do that?
TheEnvoy wrote:I guess the situation for the 209 and 109 is the same, so the answers would be: no, not possible
Phew! At least I now know why, no matter what I tried, I haven't been able to enable the mod_rewrite module in Gallery2. Oh well, perhaps one day I'll understand a little more about Linux, and a little more about QNAP's particular flavour...

Thanks for the heads-up, TE

- NAS 1 : TS-409Pro / fw: 3.3.0 Build 0924T / HDD: 4 x Samsung 500GB
- NAS 2 : TS-109 / fw: 3.3.0 Build 0924T / HDD: 1 x Samsung 2TB
- LAN : Draytek 2820Vn, Billion 7404VGO-M, Linksys SPA-3102, Asus WL-500g Premium
- AV : AC Ryan PlayOn!HD 2TB / Topfield TRF-2460 1TB / Samsung PS50C7000 / Yamaha RV-1065
User avatar
AndyChuo
Experience counts
Posts: 2388
Joined: Thu Sep 13, 2007 11:56 am
Location: Taipei, Taiwan

Re: [HOWTO] How to use .htaccess?

Post by AndyChuo »

Hi Guys,

mod_rewrite is available for manual installation, instruction is available here.

Regards

Andy
=============================================================>>>
TS-659-Pro [RAID6] rtorrent+SABnzbdplus+SickBeard+Couchpotato [Best PVR] Plex+PMS [Ultimate Streamer]
Apple iPad [Best Tablet] HTC One M8 [Mobile Phone] Samsung UA46ES6100 [My Screen] KRK Rokit 6 [Audio Speakers]
Chrome Cast [Screen Casting] Philips Hue [Personal Lighing]
Buffalo WZR-1750DHP [My Wifi Hub] D-Link DGS-1005D [Gbit Network]
=============================================================>>>
eeeuser1
Know my way around
Posts: 107
Joined: Thu Jan 17, 2008 11:45 pm

Re:

Post by eeeuser1 »

Curt wrote:Hi!

With the new betafirmware 1.1.2 0928T you can now use WinSCP to edit files.
Great, many thanks!

/Curt
This is wonderful thanks!
I never new I could do this, I struggle big time with Vi and have been copying the file to a PC, editing it, then copying it back.

Is there a similar product for if your main PC is a linux box, WinSCP for linux?
I rater like the Edit in place of files remotely, the sync of directories and the move options of WinSCP

Jeff
mnemonic123
First post
Posts: 1
Joined: Wed Mar 26, 2008 1:23 am

Re: [HOWTO] How to use .htaccess?

Post by mnemonic123 »

hi i have a TS-409 Pro and i just made the actions you have described above:

editing the apache.conf (AllowOverride AuthConfig - at first in the area you mentioned and then at any place!) always followed with a restart of apache (/etc/init.d/Qthttpd.sh restart).

the used .htacces file:
"AuthUserFile /share/Qweb/.htpasswd
AuthGroupFile /dev/null
AuthName "verwaltung"
AuthType Basic
<Limit GET>
require valid-user
</Limit>"


the used .htpasswd file:
"admin:something"

both in the directory "/share/Qweb/". THE ** DOESNT WORK. i have normal browser access without any prompt. is there any difference between the ts-409 pro and yours?




mh i got it... i edited the wrong apache.conf. why are there more than one apache.conf available!?
Post Reply

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