Apache : permission error after install

Hello,

I installed apache2 and mariadb by using Yast.
But after installation I use Yast to make apache run, goto 127.0.0.1 and see then a permission denied error.

How to solve this ?

Roelof

Some more information, please? Like the openSUSE version you use?

Have you even started Apache, and how?

What does “systemctl status apache2” say?

“Going to 127.0.0.1” (which probably means you use 127.0.0.1 as an URL in a browser on the system), will try to show you the file index.html from the server root. Which is /srv/www/htdocs/ (if you did not change the default Apache configuration).

Thus why not look there

ls -l /srv/www/htdocs/index.html

to see if that file exists and when yes, who owns it (user/group) and what the permissions are?

This directory contains this :

drwxr-xr-x 3 root root 4096 Nov 6 2013 .
drwxr-xr-x 5 root root 4096 Nov 6 2013 …
drwxr-xr-x 2 root root 4096 Nov 6 2013 gif
-rw-r–r-- 1 root root 2356 Sep 28 2013 info2html.css

Roelof

Well, as you can see yourself, there is no index.html.
How would you expect Apache to serve you one then? :wink:

So either create one yourself, or install the package “apache2-example-pages” to get a simple one.

As wolfi323 said. Web sites are not created out of the blue. I assume that when you want to run a web-server program (Apache), you have something to show to the world (or a smaller audience). :slight_smile:

And please, when posting computer output (copied/pasted from your terminal window), do so between CODE tags. You get them by clicking on the # button in the tool bar of the post editor.

Also, please do not say things like: “This directory contains this :”. Post the prompt, the command, the output and the next prompt. Then we can see what you did (and more) without you explaining it.

Thanks,

Last question.

I have to make a new virtual host or change the current host so it points to /srv/www/laravel/public instead of /src/www
According to the manual I can do this with Yast -> Network Services -> http-server But tI do not have the choice ht-server.
I work with the lastest Opensue version.

Roelof

I might misunderstand what you want, but your earlier post showed that there is no /srv/www/laravel/, let alone a /srv/www/laravel/public.

You can however change your server root in your Apache configuration file(s). I assume you know where to find them and how to handle them. Else you could maybe tell more about what you want. In other words describe the goal, not the step (How To Ask Questions The Smart Way).

Correct, this ia a new question but related to the old one.

I have installed laravel according to the manual of the site of laravel.

Now what I want to achieve is that if I type localhost or 127.0.0.1 I see the page which can be found at this url : srv/www/larael/public.

I know how to change them if I know where Opensuse has placed the file.
If I look at this page : SUSE Documentation
That page is stated I could do that with Yast but on my Yast there is no option http-server.

Roelof

Look in /etc/apache2/default-server.conf.

Thanks,

Changed that file to this :

#
# Global configuration that will be applicable for all virtual hosts, unless
# deleted here, or overriden elswhere.
#

DocumentRoot "/srv/www/htdocs/laravel/public"

#
# Configure the DocumentRoot
#
<Directory "/srv/www/htdocs/laravel/public">
        # Possible values for the Options directive are "None", "All",
        # or any combination of:
        #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiV$
        #
        # Note that "MultiViews" must be named *explicitly* --- "Options All"
        # doesn't give it to you.
        #
        # The Options directive is both complicated and important.  Please see
        # http://httpd.apache.org/docs-2.2/mod/core.html#options
        # for more information.
        Options None
        # AllowOverride controls what directives may be placed in .htaccess fil$
        # It can be "All", "None", or any combination of the keywords:
        #   Options FileInfo AuthConfig Limit
        AllowOverride None
        # Controls who can get stuff from this server.
        Order allow,deny
        Allow from all
</Directory>

restarted apache2 :

linux-s6lu:/etc/apache2 # systemctl restart apache2
linux-s6lu:/etc/apache2 # 

but still only see the starting page of apache

Roelof

I assume there s somethimg there (you did not show).

I assume that your URL fits with whatis there (you did not show).

I assume that the ownership (user/group) and permission bits allow the apache processes (by default owned by wwwrun to read that what should be shown.

We can not look in your system and not even over your shoulder.

I assume there s somethimg there

roelof@linux-s6lu:/srv/www/htdocs/laravel/public> ls
favicon.ico  index.php  packages  robots.txt
roelof@linux-s6lu:/srv/www/htdocs/laravel/public> pwd
/srv/www/htdocs/laravel/public

I assume that your URL fits with whatis there (you did not show).

I use localhost.

I assume that the ownership (user/group) and permission bits allow the apache processes (by default owned by wwwrun to read that what should be shown.

I will changed this . Owner and grouo are now root:users

When I change it. I see this :

roelof@linux-s6lu:/srv/www/htdocs> chown -R wwwrun:wwwrun laravel
chown: invalid group: ‘wwwrun:wwwrun’
roelof@linux-s6lu:/srv/www/htdocs> 

Roelof

roelof@linux-s6lu:/srv/www/htdocs> chown -R wwwrun:wwwrun laravel
chown: invalid group: ‘wwwrun:wwwrun’
roelof@linux-s6lu:/srv/www/htdocs>

I found at that it must be chown -R wwwrun:www laravel

But still no laravel welcome page.

Going to localhost/larravel/public/index.php gives a 404 error.

Roelof

You did only an

ls 

and not an

 ls -l

. How do you think you/we can check owners and permission bits?
In any case there no index.html there.

No need to do a

pwd

, your prompt shows that already, that is why we asked you to include the prompt in the copy/paste :wink:

It points to the Document root /srv/www/laravel/public/ as we discussed earlier. And the default Apache configuration then lets Apache search for the file index.html there (fall back because no file mentioned), which you showed does not exist.

It says that wwwrun is NOT an existing group. wwwrun iis a username. The group used is normaly www. Look in /etc/group if it exist.
In my system:

henk@boven:~> grep www /etc/passwd
wwwrun:x:30:8:WWW daemon apache:/var/lib/wwwrun:/bin/false
henk@boven:~> grep www /etc/group
www:x:8:
henk@boven:~>

which shows that the user wwwrun has GID 8 as primary group. It also shows that www is GID 8.

What does the following URL show you

http://localhost/manual/

Right, only an index.php.
And that might be the problem.

Have you installed apache2-mod_php?
Have you enabled the php5 module?

a2enmod php5

And then IMHO there must be a

DirectoryIndex ...... index.php

somewhere.

Yes, that is in /etc/apache2/conf.d/php5.conf (installed by apache2-mod_php5), you don’t have to add it manually.
But it’s only enabled if you enable the php5 module.

The file contains this:

<IfModule mod_php5.c>
       <FilesMatch "\.ph(p[345]?|tml)$">
           SetHandler application/x-httpd-php
       </FilesMatch>
       <FilesMatch "\.php[345]?s$">
           SetHandler application/x-httpd-php-source
       </FilesMatch>
        DirectoryIndex index.php4
        DirectoryIndex index.php5
        DirectoryIndex index.php
</IfModule>

So it is pre-configured when you activate the module. Clever (also it might not be what the web-manager likes ;)).

You did only an

ls 

and not an

 ls -l

. How do you think you/we can check owners and permission bits?
In any case there no index.html there.

linux-s6lu:/srv/www/htdocs/laravel/public # ls -al
total 24
drwxr-xr-x 3 wwwrun www 4096 Jun  1 20:16 .
drwxr-xr-x 6 wwwrun www 4096 Sep 15 20:26 ..
-rw-r--r-- 1 wwwrun www  356 Jun  1 20:16 .htaccess
-rw-r--r-- 1 wwwrun www    0 Jun  1 20:16 favicon.ico
-rw-r--r-- 1 wwwrun www 1586 Jun  1 20:16 index.php
drwxr-xr-x 2 wwwrun www 4096 Jun  1 20:16 packages
-rw-r--r-- 1 wwwrun www   24 Jun  1 20:16 robots.txt

What does the following URL show you

http://localhost/manual/
Object not found!        The requested URL was not found on this server.          If you entered the URL manually please check your     spelling and try again.      
  If you think this is a server error, please contact the [EMAIL="%5bno%20address%20given%5d"]webmaster[/EMAIL].  
  Error 404    [localhost](http://localhost/)
  Apache/2.4.6 (Linux/SUSE)