LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-15-2013, 04:50 PM   #1
beefydog
Member
 
Registered: Feb 2013
Posts: 31

Rep: Reputation: Disabled
how to use a different directory for Apache (on another volume)


I set up a directory on a separate volume called "mnt/Apps/WEBSITES" and have a subdir under that with a website
(I'll call it website1 for reference).
I set up a virtual website in Apache and set the path to "/mnt/Apps/WEBSITES/website1" and it has a file index.html

I'm not sure what I'm doing wrong but I get a 403 Forbidden error when loading the site. So I did some looking around and found the following page:
http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch20_:_The_Apache_Web_Server
and proceeded to use the chcon command to apply to my new path and ran the following:

# ls -Z
drwx------. root root system_ubject_r:file_t:s0 lost+found
drwxrwxr-x. nbadmin webadmins unconfined_ubject_r:httpd_sys_script_exec_t:s0 WEBSITES

I verified that all the subdirs had the same context as well, yet I still have the same 403 error (I stop/start Apache).

What am I doing wrong here?
 
Old 02-15-2013, 09:34 PM   #2
beefydog
Member
 
Registered: Feb 2013
Posts: 31

Original Poster
Rep: Reputation: Disabled
Does anyone know where there might be a place to look for an answer to this?
A simple how to change your directory tutorial would be nice with all the steps involved including EXACTLY what permissions, what accounts are needed and show an actual example that works.
The default page shows up, but as soon as I add another virtual website (on the other hard drive), bam! 403 permission error. Adding a site to the default folder (as in every "hello world" tutorial on the web) works just fine, but it must be on another drive.

Apache version 2.2.15
CentOS 6.3

Last edited by beefydog; 02-15-2013 at 09:37 PM.
 
Old 02-15-2013, 09:57 PM   #3
beefydog
Member
 
Registered: Feb 2013
Posts: 31

Original Poster
Rep: Reputation: Disabled
side note: This was a default installation on a brand new server, and, the Apache test page shows up, but it doesn't exist at "/var/www/html" directory (I even logged in as root to make sure I wasn't crazy), nor an .htaccess file. Madness.
 
Old 02-15-2013, 10:33 PM   #4
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,200

Rep: Reputation: 397Reputation: 397Reputation: 397Reputation: 397
the directory must be chmod 555 (dr-xr-xr-x) for it to work, preferably 755 (drwxr-xr-x) so the owner (you) have permission to write to the directory.
 
Old 02-16-2013, 02:29 PM   #5
beefydog
Member
 
Registered: Feb 2013
Posts: 31

Original Poster
Rep: Reputation: Disabled
The directory & file permissions are clearly not the problem in my case - all directories are 775 except the outer most branch "webroot" which is set to 755.
The security context appears to be the problem, but where?
 
Old 02-16-2013, 02:51 PM   #6
beefydog
Member
 
Registered: Feb 2013
Posts: 31

Original Poster
Rep: Reputation: Disabled
From another forum was suggested to run the "setenforce permissive" command - I did, and now it works. Now I have to figure out how to get this to work with SELinux turned on.
 
Old 02-16-2013, 02:55 PM   #7
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,200

Rep: Reputation: 397Reputation: 397Reputation: 397Reputation: 397
hmm
post the following

your httpd.conf

the output of the 'mount' command

the output of 'ls -lR' of /mnt
 
Old 02-17-2013, 04:51 PM   #8
beefydog
Member
 
Registered: Feb 2013
Posts: 31

Original Poster
Rep: Reputation: Disabled
the httpd.conf is too long to post on this forum. any particular section?
 
Old 02-17-2013, 05:17 PM   #9
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,200

Rep: Reputation: 397Reputation: 397Reputation: 397Reputation: 397
Quote:
Originally Posted by beefydog View Post
the httpd.conf is too long to post on this forum. any particular section?
the virtualhost section preferably
 
Old 02-17-2013, 05:24 PM   #10
beefydog
Member
 
Registered: Feb 2013
Posts: 31

Original Poster
Rep: Reputation: Disabled
### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
#NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
ServerName ammsrv2.mydomain.com
<VirtualHost 10.10.46.235>
DocumentRoot "/mnt/Apps/WEBSITES/mydomain_Com/webroot"
ServerName staging2.mydomain.com
<Directory "/mnt/Apps/WEBSITES/mydomain_Com/webroot">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
 
Old 02-17-2013, 05:25 PM   #11
beefydog
Member
 
Registered: Feb 2013
Posts: 31

Original Poster
Rep: Reputation: Disabled
mount


/dev/mapper/vg_nbweb-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_ubject_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
/dev/mapper/vg_nbweb-lv_home on /home type ext4 (rw)
/dev/sdb1 on /mnt/Apps type ext4 (rw,noatime,nodiratime)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
gvfs-fuse-daemon on /root/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev)
 
Old 02-17-2013, 05:27 PM   #12
beefydog
Member
 
Registered: Feb 2013
Posts: 31

Original Poster
Rep: Reputation: Disabled
.:
total 12
drwxrwxrwx. 5 nbadmin users 4096 Feb 13 15:22 Apps
drwxr-xr-x. 2 root root 4096 Jan 31 09:42 boot
drwxr-xr-x. 2 root root 4096 Jan 31 09:42 home

./Apps:
total 20
drwx------. 2 root root 16384 Jan 31 10:44 lost+found
drwxrwxr-x. 3 root root 4096 Feb 12 08:26 WEBSITES

./Apps/lost+found:
total 0

./Apps/WEBSITES:
total 4
drwxrwxr-x. 4 root root 4096 Feb 15 13:20 mydomain_Com

./Apps/WEBSITES/mydomain_Com:
total 8
drwxrwxr-x. 2 root root 4096 Feb 14 13:04 test
drwxrwxr-x. 2 root root 4096 Feb 15 13:25 webroot

./Apps/WEBSITES/mydomain_Com/test:
total 0

./Apps/WEBSITES/mydomain_Com/webroot:
total 4
-rwxr-xr-x. 1 root root 162 Feb 15 13:25 index.html

./boot:
total 0

./home:
total 0
 
Old 02-17-2013, 06:32 PM   #13
fbobraga
Member
 
Registered: Jul 2010
Location: São Paulo - Brasil
Distribution: Debian 7 / Crunchbang 11
Posts: 229

Rep: Reputation: 41
Quote:
Originally Posted by beefydog View Post
the httpd.conf is too long to post on this forum. any particular section?
paste all the content inside code tags: http://www.bbcode.org/examples/?id=15 (it creates a reasonably area with scrolls)

Last edited by fbobraga; 02-17-2013 at 06:35 PM.
 
Old 02-18-2013, 02:25 AM   #14
fortran
Member
 
Registered: Nov 2011
Location: Cairo, Egypt
Distribution: CentOS, RHEL, Fedora
Posts: 300
Blog Entries: 2

Rep: Reputation: 51
What is value of attribute 'DocumentRoot' in your httpd.conf file?
&
What is the value of folllowing attribute in your httpd.conf file?
Code:
# This should be changed to whatever you set DocumentRoot to.
<Directory "/path/of/the/project">
 
Old 02-18-2013, 09:31 AM   #15
beefydog
Member
 
Registered: Feb 2013
Posts: 31

Original Poster
Rep: Reputation: Disabled
Code:
<VirtualHost 10.10.46.235>
DocumentRoot "/mnt/Apps/WEBSITES/mydomain_Com/webroot"
ServerName staging2.mydomain.com
<Directory "/mnt/Apps/WEBSITES/mydomain_Com/webroot">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LVM Mount Physical Volume/Logical Volume without a working Volume Group mpivintis Linux - Newbie 10 01-11-2014 08:02 AM
[SOLVED] System Volume Information/: critical directory? stf92 Slackware 4 12-24-2012 05:01 PM
creating a remote volume in a directory in Linux danibhai Linux - Newbie 2 10-18-2011 04:36 AM
Apache Directory Listing Of NFS Mount, cannot view directory list via apache luqmana Linux - Networking 2 12-19-2005 07:03 AM
Bad key or directory name (gnome volume control) okasion Linux - Hardware 0 05-05-2003 07:12 PM


All times are GMT -5. The time now is 06:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration