LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-24-2010, 01:13 AM   #1
Usalabs
Member
 
Registered: Jan 2004
Distribution: OpenSUSE 42.1 Server
Posts: 158

Rep: Reputation: 15
Apache2 not serving html pages (really PISSED!!!)


I just did yet another fresh install of OpenSuse 11.1, (no DVD drive otherwise I would use the newer version), all updates have been performed, I installed apache2 and it's modules, php5 and some of the modules I needed, mysql, sshd for local only access, and webmin, postfix is used only for local mail between php scripts and the system, mainly because out-of-the-box, postfix is an open relay, and can take weeks to configure as an SMTP server, so I have to use php scripts that do not use a mail server, anyway.

The problem is, apache2 only seems to know how to serve php files, html files only get shown on ANY browser as source code not the contents.

I've been trying for 3 weeks,,, messing with this option, setting that option, and screwing up the system, hence reformatting and re-installing OpenSuse several times, so if anyone wants to try and get apache to serve html files properly and to have apache use mod_rewrite as default on ANY folder whether inside or outside the document root, I can give that person full ssh access. I've got to the point now, that I don't really give a damn what happens to the server, Linux is really PISSING me OFF!!!!!

What I should be able to do, is, leave the apache and php setting as default,,, upload either an html or php file to the document root and direct a browser to the address, and it'll work without changing a single item, the same is if that file has rewrite, it should work flawless, or if I upload an html or php file to a folder outside the doc root, I change the doc redirect to point to the folder, and it should work without changing anything else.

PM me and I'll set up full ssh access
 
Old 12-24-2010, 11:20 AM   #2
ComputerErik
Member
 
Registered: Apr 2005
Location: NYC
Distribution: Debian, RHEL
Posts: 269

Rep: Reputation: 54
Why would you expect (and trust!) a complete stranger to setup a server for you? Also what happens once it is up and running and there are problems?

Setting up Apache to serve HTML should not be that difficult, I think you would be much better off posting the httpd.conf file here and getting an understanding of how this should work so you can fix it yourself.
 
Old 12-24-2010, 08:47 PM   #3
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
I agree. Giving someone you don't know full (root) access to your server is not safe. There is a better than 99% likelihood that they will be honest, but you just don't know and you really can't take that chance.

Before you get to the rest of my message: did you restart and reload apache after making any changes? If not, this could be your problem. If so, keep reading.

It sounds like you are trying to accomplish a lot in one go with Apache, PHP, MySQL, Webmin, and Postfix. Slow down and try taking one thing at a time. You are correct, out of the box, Apache should serve up basic web pages. From a fresh install it should give you some sort of (html) 'It Works' page. Once you have this, then move on to PHP and get that working. Next, install MySQL and possibly MyAdmin. I have never used it, but I would be cautious of webmin. Per the webmin home page, it is meant to be a web-gui interface to your configuration files and it sounds like your configuration files may be part of the problem. Also, out of the box, Postfix should not be an open relay. By default it will only send when the incoming message is from the 'my_networks' parameter. You can add various authentication methods, but you are correct that it will take time to set it all up. Besides you need to get the other stuff working first.

So, with that in mind, please start as fresh as you can, and lets start with Apache. It make take a little doing, but the folks at LQ will help you along the way. Can you get it to where you get the default page and then modify that page? If so, then move something out of the document root and try again. If not, it could mean that you are facing a groups or permissions problem with the apache user or the vhost file tree. In case you are having problems, please post your Apache configuration file(s), the errors that you are encountering and any appropriate input from your syslog, apache log, etc.
 
Old 12-24-2010, 10:07 PM   #4
Usalabs
Member
 
Registered: Jan 2004
Distribution: OpenSUSE 42.1 Server
Posts: 158

Original Poster
Rep: Reputation: 15
After yet another fresh install, I managed to get sshd access from my workstation and only have webmin (I use webmin as I hate using vi on config files) access from inside the network by opening the webmin port in the server firewall, the external, hardware firewall, has only port 80 and 443 open to the internet, in the Yast software manager, using root ssh access (only internal access allowed), I selected web server package, which installed apache2, php5, and mysql as a package, I have my domain name providers, DNS pointing to my static IP address.

After securing mysql using 'mysql_secure_installation' I left apache settings as default, and pointed my browser to my domain name, and I got the 'It Works!' page, now,,the document root is at /srv/www/htdocs so I created a directory at /srv/www/testdir then put a basic html file in there, then using webmin, I changed the default server document redirect to show '/test /srv/www/testdir/' so that when I use www.mydomain.xxx/testdir/test.html' it should show the words 'Successful Test', but instead I get 'Error 403 Permission denied', the testdir and it's contents are recursively chmod 777 (for testing), I also have mod_rewrite set using 'a2enmod rewrite', I also restart apache after every change.

I also have php running good, but mod_rewrite only seems to work in the doc root.
The below codes are the '.htaccess and rewrite.php' files in /srv/www/TEST which, when entered as www.mydomain.xxx/test/rewrite.php does ahow the page, but when link2 is clicked on, 'Object not found' error is displayed, apache error_log for that error shows:-
'[error] [client IP] File does not exist: /srv/www/htdocs/srv, referer: http://mydomain.xxx/test/rewrite.php?link=1, which means the rewrite isn't working.

To see this in action, http://myfriendsbook.dyndns.org = 'It Works!', http://myfriendsbook.dyndns.org/test/rewrite.php = rewrite test page, then click on link2.

I would like to get mod_rewrite to work outside the doc root, specifically at folders inside the /srv/www location.

.htaccess
Code:
RewriteEngine On
RewriteRule ^link([^/]*).html$ rewrite.php?link=$1 [L]
rewrite.php
Code:
// Rewrite.php
<html>
<h2 align=center> 
<?php 
// mod_rewrite Test Page 
// Copyright 2006 Webune.com 
if($_GET['link']==1){echo"You are not using mod_rewrite";} 
elseif($_GET['link']==2){echo"Congratulations!! You are using Apache mod_rewrite";} 
else{echo"Linux Apache mod_rewrte Test Tutorial";} 
?> 
</h2> 

<hr> 

<head> 
<title>How To Test mod_rewrite in Apache Linux Server</title> 
</head> 

<body> 
<p align="center">by <a href="http://www.webune.com">Webune</a></p> 
<p><a href="rewrite.php?link=1">LINK1</a> = rewrite.php?link=1</p>
<p><a href="link2.html">LINK2</a> = link2.html</p> 
<p>How this works: both links are for this same page, except they both are different. link one is without the mod_rewrite and link2 is using mod_rewrite. Link1 show the php file, with with mod_rewrite we are mascarading the php file into a html file. you can use whatever type of extension you want, you can change it to .htm or .shtml etc... all you have to do is to make sure you also chang it in the .htaccess file</p> 
<p>&lt;&lt; <a href="http://www.webune.com/forums/viewtopic-p-62.html">Go back to webune forums.</a></p> 
</body> 
</html>
As can be seen below, the httpd.conf contains loads of conf includes.
Code:
#
# /etc/apache2/httpd.conf 
#
# This is the main Apache server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs-2.2/> for detailed information about
# the directives.

# Based upon the default apache configuration file that ships with apache,
# which is based upon the NCSA server configuration files originally by Rob
# McCool. This file was knocked together by Peter Poeml <poeml+apache@suse.de>.

# If possible, avoid changes to this file. It does mainly contain Include
# statements and global settings that can/should be overridden in the
# configuration of your virtual hosts.

# Quickstart guide:
# http://www.opensuse.org/Apache_Howto_Quickstart


# Overview of include files, chronologically:
#
# httpd.conf
#  | 
#  |-- uid.conf  . . . . . . . . . . . . . .  UserID/GroupID to run under
#  |-- server-tuning.conf  . . . . . . . . .  sizing of the server (how many processes to start, ...)
#  |-- sysconfig.d/loadmodule.conf . . . . .[*] load these modules
#  |-- listen.conf . . . . . . . . . . . . .  IP adresses / ports to listen on
#  |-- mod_log_config.conf . . . . . . . . .  define logging formats
#  |-- sysconfig.d/global.conf . . . . . . .[*] server-wide general settings
#  |-- mod_status.conf . . . . . . . . . . .  restrict access to mod_status (server monitoring)
#  |-- mod_info.conf . . . . . . . . . . . .  restrict access to mod_info
#  |-- mod_usertrack.conf  . . . . . . . . .  defaults for cookie-based user tracking
#  |-- mod_autoindex-defaults.conf . . . . .  defaults for displaying of server-generated directory listings
#  |-- mod_mime-defaults.conf  . . . . . . .  defaults for mod_mime configuration
#  |-- errors.conf . . . . . . . . . . . . .  customize error responses
#  |-- ssl-global.conf . . . . . . . . . . .  SSL conf that applies to default server _and all_ virtual hosts
#  |
#  |-- default-server.conf . . . . . . . . .  set up the default server that replies to non-virtual-host requests
#  |    |--mod_userdir.conf  . . . . . . . .  enable UserDir (if mod_userdir is loaded)
#  |    `--conf.d/apache2-manual?conf  . . .  add the docs ('?' = if installed)
#  |
#  |-- sysconfig.d/include.conf  . . . . . .[*] your include files 
#  |                                             (for each file to be included here, put its name 
#  |                                              into APACHE_INCLUDE_* in /etc/sysconfig/apache2)
#  |
#  `-- vhosts.d/ . . . . . . . . . . . . . .  for each virtual host, place one file here
#       `-- *.conf . . . . . . . . . . . . .     (*.conf is automatically included)
#
#
# Files marked[*] are created from sysconfig upon server restart: instead of
# these files, you edit /etc/sysconfig/apache2



#  Filesystem layout:
#
# /etc/apache2/
#  |-- charset.conv  . . . . . . . . . . . .  for mod_auth_ldap
#  |-- conf.d/
#  |   |-- apache2-manual.conf . . . . . . .  conf that comes with apache2-doc
#  |   |-- mod_php4.conf . . . . . . . . . .  (example) conf that comes with apache2-mod_php4
#  |   `-- ... . . . . . . . . . . . . . . .  other configuration added by packages
#  |-- default-server.conf
#  |-- errors.conf
#  |-- httpd.conf  . . . . . . . . . . . . .  top level configuration file
#  |-- listen.conf
#  |-- magic
#  |-- mime.types -> ../mime.types
#  |-- mod_autoindex-defaults.conf
#  |-- mod_info.conf
#  |-- mod_log_config.conf
#  |-- mod_mime-defaults.conf
#  |-- mod_perl-startup.pl
#  |-- mod_status.conf
#  |-- mod_userdir.conf
#  |-- mod_usertrack.conf
#  |-- server-tuning.conf
#  |-- ssl-global.conf
#  |-- ssl.crl/  . . . . . . . . . . . . . .  PEM-encoded X.509 Certificate Revocation Lists (CRL)
#  |-- ssl.crt/  . . . . . . . . . . . . . .  PEM-encoded X.509 Certificates
#  |-- ssl.csr/  . . . . . . . . . . . . . .  PEM-encoded X.509 Certificate Signing Requests
#  |-- ssl.key/  . . . . . . . . . . . . . .  PEM-encoded RSA Private Keys
#  |-- ssl.prm/  . . . . . . . . . . . . . .  public DSA Parameter Files
#  |-- sysconfig.d/  . . . . . . . . . . . .  files that are created from /etc/sysconfig/apache2
#  |   |-- global.conf
#  |   |-- include.conf
#  |   `-- loadmodule.conf
#  |-- uid.conf
#  `-- vhosts.d/ . . . . . . . . . . . . . .  put your virtual host configuration (*.conf) here
#      |-- vhost-ssl.template
#      `-- vhost.template



### Global Environment ######################################################
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests.

# run under this user/group id
Include /etc/apache2/uid.conf

# - how many server processes to start (server pool regulation)
# - usage of KeepAlive
Include /etc/apache2/server-tuning.conf

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
ErrorLog /var/log/apache2/error_log

# generated from APACHE_MODULES in /etc/sysconfig/apache2
Include /etc/apache2/sysconfig.d/loadmodule.conf

# IP addresses / ports to listen on
Include /etc/apache2/listen.conf

# predefined logging formats
Include /etc/apache2/mod_log_config.conf

# generated from global settings in /etc/sysconfig/apache2
Include /etc/apache2/sysconfig.d/global.conf

# optional mod_status, mod_info
Include /etc/apache2/mod_status.conf
Include /etc/apache2/mod_info.conf

# optional cookie-based user tracking
# read the documentation before using it!!
Include /etc/apache2/mod_usertrack.conf

# configuration of server-generated directory listings
Include /etc/apache2/mod_autoindex-defaults.conf

# associate MIME types with filename extensions
TypesConfig /etc/apache2/mime.types
DefaultType text/plain
Include /etc/apache2/mod_mime-defaults.conf

# set up (customizable) error responses
Include /etc/apache2/errors.conf

# global (server-wide) SSL configuration, that is not specific to 
# any virtual host
Include /etc/apache2/ssl-global.conf

# forbid access to the entire filesystem by default
<Directory />
    Options None
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

# use .htaccess files for overriding,
AccessFileName .htaccess
# and never show them
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>

# List of resources to look for when the client requests a directory
DirectoryIndex index.html index.html.var

### 'Main' server configuration #############################################
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition.  These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
Include /etc/apache2/default-server.conf


# Another way to include your own files
#
# The file below is generated from /etc/sysconfig/apache2,
# include arbitrary files as named in APACHE_CONF_INCLUDE_FILES and
# APACHE_CONF_INCLUDE_DIRS
Include /etc/apache2/sysconfig.d/include.conf


### Virtual server configuration ############################################
#
# 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.
#
Include /etc/apache2/vhosts.d/*.conf
<Directory "/srv/www/Dolphin">
allow from all
</Directory>
<Directory "/srv/www/TEST">
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
 Allow from all
</Directory>


# Note: instead of adding your own configuration here, consider 
#       adding it in your own file (/etc/apache2/httpd.conf.local)
#       putting its name into APACHE_CONF_INCLUDE_FILES in 
#       /etc/sysconfig/apache2 -- this will make system updates 
#       easier :)
default-server.conf
Code:
#
# Global configuration that will be applicable for all virtual hosts, unless
# deleted here, or overriden elswhere.
# 

DocumentRoot "/srv/www/htdocs"

#
# Configure the DocumentRoot
#
<Directory "/srv/www/htdocs">
 	# Possible values for the Options directive are "None", "All",
	# or any combination of:
	#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
	#
	# 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 files.
	# 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>

# Aliases: aliases can be added as needed (with no limit). The format is 
# Alias fakename realname
#
# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL.  So "/icons" isn't aliased in this
# example, only "/icons/".  If the fakename is slash-terminated, then the 
# realname must also be slash terminated, and if the fakename omits the 
# trailing slash, the realname must also omit it.
#
# We include the /icons/ alias for FancyIndexed directory listings.  If you
# do not use FancyIndexing, you may comment this out.
#
Alias /icons/ "/usr/share/apache2/icons/"
Alias /dolphin "/srv/www/Dolphin/"
Alias /test "/srv/www/TEST/"

<Directory "/usr/share/apache2/icons">
 Options Indexes MultiViews
 AllowOverride None
 Order allow,deny
 Allow from all
</Directory>

# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"

# "/srv/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/srv/www/cgi-bin">
 AllowOverride None
 Options +ExecCGI -Includes
 Order allow,deny
 Allow from all
</Directory>

# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
#
# To disable it, simply remove userdir from the list of modules in APACHE_MODULES 
# in /etc/sysconfig/apache2.
#
<IfModule mod_userdir.c>
 	# Note that the name of the user directory ("public_html") cannot simply be
	# changed here, since it is a compile time setting. The apache package
	# would have to be rebuilt. You could work around by deleting
	# /usr/sbin/suexec, but then all scripts from the directories would be
	# executed with the UID of the webserver.
UserDir public_html
 	# The actual configuration of the directory is in
	# /etc/apache2/mod_userdir.conf.
Include /etc/apache2/mod_userdir.conf
</IfModule>


# Include all *.conf files from /etc/apache2/conf.d/.
#
# This is mostly meant as a place for other RPM packages to drop in their
# configuration snippet.
#
# You can comment this out here if you want those bits include only in a
# certain virtual host, but not here.
#
Include /etc/apache2/conf.d/*.conf

# The manual... if it is installed ('?' means it won't complain)
Include /etc/apache2/conf.d/apache2-manual?conf
ServerName linux-4spd

ServerAdmin root@linux-4spd

Last edited by Usalabs; 12-25-2010 at 09:00 AM.
 
Old 12-24-2010, 10:30 PM   #5
ComputerErik
Member
 
Registered: Apr 2005
Location: NYC
Distribution: Debian, RHEL
Posts: 269

Rep: Reputation: 54
It looks like you have no configuration in httpd.conf for your new test directory, /srv/www/testdir/, so it is defaulting to deny all. Try copying (or changing) the htmldocs config for your directory.

Also IMHO Webmin might be part of the problem, I have not really used it much myself but have helped friends having problems getting a config to work when using Webmin but if I manually check the config files find problems which are easily fixed.
 
Old 12-24-2010, 10:42 PM   #6
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
Usalabs not to add some sour milk but
you really should put opensuse 11.3 on a usb or a local net install seeing as 11.1 is at End Of Life

never used "Webmin " just bash/ssh or a text editor to read and configure them by hand
but seeing as i like to use a source install for apache, php,mysql,phpmyadmin,awstats ,perl ,... and not rely on rpm's
 
Old 12-25-2010, 08:31 AM   #7
Usalabs
Member
 
Registered: Jan 2004
Distribution: OpenSUSE 42.1 Server
Posts: 158

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by ComputerErik View Post
It looks like you have no configuration in httpd.conf for your new test directory, /srv/www/testdir/, so it is defaulting to deny all. Try copying (or changing) the htmldocs config for your directory.

Also IMHO Webmin might be part of the problem, I have not really used it much myself but have helped friends having problems getting a config to work when using Webmin but if I manually check the config files find problems which are easily fixed.
I removed the 'testdir' because I couldn't get it working, and concentrated on /srv/www/TEST and getting mod_rewrite to work outside the doc root.

Did anyone try the links to view the problem I'm having with mod_rewrite?

I prefer to use a 'point and click' method such as webmin, because I can directly edit the httpd.conf manually, via webmin, using vi in an ssh console is very daunting because there's so many keyboard hotkeys to remember, when I can just copy and paste the contents of httpd.conf from webmin to gedit, modify, the copy and paste back to webmin.

Quote:
Originally Posted by John VV
you really should put opensuse 11.3 on a usb or a local net install seeing as 11.1 is at End Of Life
Unfortunately, through past experiences with pen drives, they are completely unreliable, I had to trash most of my pen drives, ranging from 2GB to 32GB, one minute they worked, and the next, they didn't and finally they gave up completely, no computer could read them or even acknowledge they were inserted, hence using CDR, also, I don't have the knowledge of booting the server from the network, and installing OpenSuSe 11.3 from the network, as my server is home built, the CPU doesn't have VM support via a KVM.

I used to have a CD with just an internet install version of Linux, but it's no longer supported.
 
Old 12-25-2010, 09:04 AM   #8
Usalabs
Member
 
Registered: Jan 2004
Distribution: OpenSUSE 42.1 Server
Posts: 158

Original Poster
Rep: Reputation: 15
If anyone tried those test links, and got 'Page can not be found'.

I just recently found out my ISP blocks ports 25, 80, and 443, (they say if you want to use those ports, then buy a business account, yeah right!), so I'm using a free dns service to forward port 80 to a non standard port, and set apache accordingly, and updated and tested the test links in my 2nd post to reflect the changes.
 
Old 12-25-2010, 09:19 AM   #9
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

Are you sure that "a2enmod rewrite" is the correct way to enable mod_rewrite? Because this is used for debian based distros, while for suse, you should go like this
Also error_log might be of help here, to see if mod_rewrite is actually loaded

Regards
 
Old 12-25-2010, 10:24 AM   #10
ComputerErik
Member
 
Registered: Apr 2005
Location: NYC
Distribution: Debian, RHEL
Posts: 269

Rep: Reputation: 54
Quote:
Originally Posted by Usalabs View Post
If anyone tried those test links, and got 'Page can not be found'.

I just recently found out my ISP blocks ports 25, 80, and 443, (they say if you want to use those ports, then buy a business account, yeah right!), so I'm using a free dns service to forward port 80 to a non standard port, and set apache accordingly, and updated and tested the test links in my 2nd post to reflect the changes.
I am getting errors with any of the pages. But this new information brings about other potential problems. If your ISP is blocking traffic they might be part of the problem. You will also need to have your firewall configured properly to port forward to the server. All that aside none of this should affect your ability to connect locally using your internal IP.

Again it seems to me that your Apache configuration isn't setup properly since everything works fine from the default docroot directory, but not outside of that. Have you tried changing the directory path in the httpd.conf file from the default to your new one? Are you running SELinux, as I have seen problems with this in RedHat if you are hosting pages outside of the default docroot. Are there any clues in your log files about what is happening?
 
Old 12-25-2010, 01:34 PM   #11
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
if you gave up on usb drives and do not have a dvd drive and have no idea how to install from your local network ??
then how are you reinstalling openSUSE 11.1 ?


as for the
mod_rewrite, what rules have you set? is it set in the http.conf? and is there a error in the apache log ?
 
Old 12-25-2010, 04:02 PM   #12
Usalabs
Member
 
Registered: Jan 2004
Distribution: OpenSUSE 42.1 Server
Posts: 158

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by bathory View Post
Hi,

Are you sure that "a2enmod rewrite" is the correct way to enable mod_rewrite? Because this is used for debian based distros, while for suse, you should go like this
Also error_log might be of help here, to see if mod_rewrite is actually loaded

Regards
Yes because when I look in sysconfig I see the module there, and also a2enmod -l shows all the modules listed and rewrite is the last item,,,plus the doc root works perfect with rewrite, and also when creating a named based virtual server, rewrite also works, but outside default /srv/www/htdocs rewrite doesn't work.

Quote:
Originally Posted by John VV
if you gave up on usb drives and do not have a dvd drive and have no idea how to install from your local network ??
then how are you reinstalling openSUSE 11.1 ?
OpenSuSe 11.1 is on a 700MB CD-R, packages are downloaded and installed from the OpenSuSe repos site.

I just now finished installing OpenSuSe 11.3 using internet install, the boot image and installer is only 114MB, I burnt the ISO on a CD-R, it took 2hrs to install from the internet.

Even with OpenSuSe 11.3, rewite still works in default /srv/www/htdocs, but sill will not work out side the default doc root

The test links now work, if anyone want to try them.

The error_log file shows:- [error] [client IP] File does not exist: /srv/www/TEST, referer: http://mydomain.xxx/test/rewrite.php?link=1, which means the rewrite still isn't working.

Last edited by Usalabs; 12-25-2010 at 04:03 PM.
 
Old 12-25-2010, 04:49 PM   #13
Usalabs
Member
 
Registered: Jan 2004
Distribution: OpenSUSE 42.1 Server
Posts: 158

Original Poster
Rep: Reputation: 15
I may have an idea it's the rewrite rule, that's stopping it from working outside the default doc root, looking at error_log, I noticed the rewrite tries to send /srv/www/htdocs/srv using this rule:-
Code:
RewriteRule ^link([^/]*).html$ rewrite.php?link=$1 [L]
according to the rule, it looks for a page at '/srv/www/htdocs/srv' which does not exist, instead of looking in the folder that the rewrite rule is actually located at, and gives this error in the log file:- '[client IP] File does not exist: /srv/www/htdocs/srv, referer: http://my-homeftp.dyndns.org:11080/t...ite.php?link=1' but when placed in the doc root, it works perfectly.

Notice, the location 'my-homeftp.dyndns.org:11080', that is the location that gets returned by the url redirect at dyndns.org, because of my ISP blocking port 80, I had to resort to using a non standard port, and use url redirect.

I really don'y understand rewrite rules and the regex used, I'm just shooting in the dark .

Last edited by Usalabs; 12-25-2010 at 04:54 PM.
 
Old 12-25-2010, 04:58 PM   #14
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
OK, 1st you'll need:
Code:
Alias /test /srv/www/TEST
without the trailing slash after TEST.

Then in the .htaccess file add:
Code:
RewriteBase /test
before the Rewriterule
 
Old 12-25-2010, 09:06 PM   #15
Usalabs
Member
 
Registered: Jan 2004
Distribution: OpenSUSE 42.1 Server
Posts: 158

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by bathory View Post
OK, 1st you'll need:
Code:
Alias /test /srv/www/TEST
without the trailing slash after TEST.

Then in the .htaccess file add:
Code:
RewriteBase /test
before the Rewriterule
The alias I already added, but the RewriteBase I added before the rule, worked a charm, at least I know now to add that RewriteBase to .htaccess in any off root folders,,, thanks.
 
  


Reply



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
apache2 .html pages not being parsed mgichoga Debian 1 03-03-2007 08:58 PM
Apache not serving pages bcf2 Linux - Software 1 11-22-2005 03:46 AM
Firefox runs slow when serving up HTML Pages lennysokol Linux - Software 2 05-16-2005 08:25 PM
My Apache2 fails to parse php-scripts in html pages 3-1415 Linux - Software 6 10-21-2004 05:59 AM
Cookie Sharing Between CGI generated HTML pages and standard HTML pages rkwhited Linux - Newbie 5 08-15-2004 07:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:51 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
Open Source Consulting | Domain Registration