Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i move Apache localhost from /var/www to my mount directory

I am new in ubuntu(and Linux) and have simple-lamer question.

I have mounted directory /media/2A98EDD2ACA90087/WebProject/ and would like to move http:/localhost/ from var/www to /media/2A98EDD2ACA90087/WebProject/

I have change sites-enabled/000-default and /etc/apache2/sites-available

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /media/2A98EDD2ACA90087/WebProject
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /media/2A98EDD2ACA90087/WebProject>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

And have this apache message!

Forbidden You don't have permission to access / on this server

When i have created "test" dir and move localhost from var/www to var/www/test - everything works. I suppose that problem with file permissions??!What should i do?


The problem has been solved. Thanks Patrick and Joh. Really need to give read access to index.html: chmod 644 /media/2A98EDD2ACA90087/WebProject/index.html

But i can't change access to my Ntfs mounted drive. I have to remount

why cant change permission ownership group of external hard drive on ubuntu

like image 474
Stepchik Avatar asked Nov 04 '22 16:11

Stepchik


1 Answers

The apache server runs as a certain user -- probably "apache", you can run ps to see -- and that user must have permission to access the webroot. You can make it be owned by apache, or make it group-readable (and you'll probably want it group-writable) and either add apache to the group that owns it, or change the group to apache's group.

Assuming httpd runs as "apache" (group: apache) and you are "jdoe" (group: jdoe)

$ sudo chown -R jdoe:apache /media/2A98EDD2ACA90087/WebProject
$ sudo chmod -R 755 /media/2A98EDD2ACA90087/WebProject
like image 142
Patrick Fisher Avatar answered Nov 07 '22 07:11

Patrick Fisher