Apache configuration issues

Hello, my system is 13.1 and I have apache 2.4.7-3.4, php 5.5.9-212.3 and mysql

base dir for web is /srv/www/htdocs/
it belonged to root, but I manually created user apache in group www and made chown.

I have several sites installed on local host, for example http://localhost/wordpress/

homepage is opening, but, no images (subfolders) and error opening any url inside the site, error - not found.
What is a problem in configuration?

What is the error exactly? Without it all we can do is speculate wildly
on all of the possible errors that can come up from a web session, and you
can find those in the HTTP RFCs. Post the source of a page calling out
which link is broken, if nothing else.


Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below…

Changing /srv/www/htdocs to wwwrun is an EXTREMELY BAD IDEA. You should never, NEVER do it - root.root should own ALL files there except those that you wish scripts to have the ability to write to (such as an upload directory and even that should be owned by root but have a world write permission)

Your issue is most likely that Wordpress requires the Rewrite module to be enabled and certain Apache configuration directives to be changes (Allowing certain overrides for that directory) - look at /var/log/apache2/error_log

And for the love of god, chown the files back to root.

you either put youir pages back in htdocs or you’ve to edit /etc/sysconfig/apache2

@Trulala82

  1. Good SOP is to install a working solution before you tinker with settings. It’s unclear whether your website ever worked or if you started tinkering before you know your website works.

  2. If you’re new to apache, or specifically apache on openSUSE, instead of modifying your Apache configuration directly, I’d recommend you use the YAST httpd applet… Although there’s some minor things I’ve found that don’t work, those won’t prevent you from configuring Apache correctly. To install,

zypper in yast2-http-server
  1. Although openSUSE does setup root-root permission on the website files, I share your aversion to setting up this way. I haven’t researched whether a Policy might restrict permissions in a different way, changing permissions to its own user account is a common way to restrict permissions, but is more involved than simply doing what you’ve described. Recommend you reverse (chown back to root-root) if you don’t have a complete cookbook for implementing this. But, based purely on your description it sounds to me like your subdirectories may have different file permissions than your web root. Of course, this assumes a very basic website configuration without virtual directories and the like.

HTH,
TSU

Let me speculate wildly!
This sounds like wordpress was installed in /srv/www/htdocs/ so thats the path in the mysql database. Now, it’s in /srv/www/htdocs/wordpress. So going to http://localhost/wordpress will get you the index.php, but the database is looking somewhere else.

Good speculation.

OP, if you are going to run multiple websites are you configuring separate vhosts for them or just installing them in subdirs of the default site?

As for root:root permissions, note that apache is initially started as root as it listens on a privileged port. It then forks the the subprocesses run as wwwrun (see pstree or ps aux | grep apache and look at the parent process). For the same reason, you can see permissions on /var/log/apache2/ are also root:root, yet apache can write logs here. Some Linux distributions uses different permissions on these area, but Suse and Red Hat both use root:root.