Apache 2 setup

Hey everyone-
I’m running opensuse 12.1. I am trying to learn apache… I made sure apache2 was enabled and started in YaST, but when I try 127.0.0.1 in the browser it says access forbidden.The opensuse wiki SDB:Apache installation - openSUSE mentions something about adding the apache2 and apache ssl configurations to FW_CONFIGURATIONS_EXT in /etc/sysconfig/SuSEfirewall2, but it is not clear to me how to do it… I typed the commands it stated in that section and just the prompt was returned to me?

Any help is appreciated :slight_smile:

On 2012-07-03 04:46, dtmc wrote:
>
> Hey everyone-
> I’m running opensuse 12.1. I am trying to learn apache… I made sure
> apache2 was enabled and started in YaST, but when I try 127.0.0.1 in the
> browser it says access forbidden.

The starting point would be to look at the apache logs.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

It’s better to look at your real IP address, like 192.168.44.10 (or whatever). Anyway, likely you’ve got a configuration with no access allowed to the root directory. Have a look in the file /etc/apache2/default-server.conf to see what you’ve created. And also in the folder /etc/apache2/vhosts.d.

In the former I have this:

ServerName lampserver
NameVirtualHost 10.0.1.33
ServerAdmin abc@def.com

DocumentRoot "/home/websites/public_html"
<Directory "/home/websites/public_html">
Options none
AllowOverride None
Order allow,deny
Allow from all
</Directory>

That defines the global document root.

And in the directory vhosts.d I have the file filename.conf with these contents:

# file:///etc/apache2/vhosts.d/filename.conf
<VirtualHost 10.0.1.33>
 ServerName swerdna.dyndns.org
 ErrorLog /var/log/apache2/swerdna.dyndns.org.txt
 DocumentRoot /home/websites/public_html/siteoffline

 <Directory "/home/websites/public_html/dydndsdocroot">
  Options None
  Options +ExecCGI +Includes -Indexes
  AddHandler cgi-script .lnx
  AllowOverride None
  Order allow,deny
  Allow from all
 </Directory>

</VirtualHost> 

So, do you have stuff like that? What is it?

and this might be worth a look: HowTo: Configure a Linux Apache Web Server on Suse/openSUSE (A bit old, but still valid)

I follow this simple procedure to run a local webserver for development:

  1. Install the LAMP-server pattern through Yast2’s Softwaremanagement. Make sure to exit Yast2 afterwards, otherwise you will not see the http-server module.
  2. Start myqsld through Yast2 - System - Runlevel editor
  3. Yast2 - Networkservices - HTTP-server. I leave everything default, make 127.0.0.1 the default listen IP, open port in firewall. Finish it.
  4. Browse to 127.0.0.1 and the default index.html in /srv/www/htdocs, which says It works !!

From here on I know I have a correct, working situation. Next I use Yast2 to add listening IP’s, apache modules etc. etc. I never run from the root webfolder, but from subfolders instead:
/srv/www/htdocs/knurpht, which I would “visit” using 127.0.0.1/knurpht

Just curious: why the mysqld?

Thanks knurpht, ‘it worked!’ However, the step 3 where you described going to http server, the option for me to open firewall was grayed out?