SUSE / openSUSEThis Forum is for the discussion of Suse Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am trying to get SSI working on my localhost to serve up a consistent site header. This works on my remote host www.lameschmillen.com - look at the Site Map to see what I am doing - but I would like to able to use localhost as a test site before inflicting new content on to an unsuspecting world -
I get the page rendered, but without the header.
Like this -
Quote:
This is lameschmillen.com which is a coverall address for a number of websites.
If you are looking for the previous site, which is our personal website, it is now reassigned to lameschmillen.net. You can use that address or go directly to it here
Any problems, please feel free to email me Here
No witch, no warrior, no buttons.
Firefox/Tools/Web Developer/Web Console shows no attempt to serve the header. I suppose from this that SSI is not being attempted at all, ie is not enabled.
I am using the XBitHack method. I need to do this for compatibility with DigiKam photo galleries.
Here is my httpd.conf and .htaccess files on localhost (initial comments left out)
httpd.conf under root/etc/apache2
Quote:
### 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
# allow access to the entire filesystem by default
<Directory />
Options All
AllowOverride All
Order allow,deny
Allow from all
</Directory>
# use .htaccess files for overriding,
AccessFileName .htaccess
# and never show them
<Files ~ "^\.ht">
Order allow,deny
Allow 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
# 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
And .htaccess under root/srv/www/htdocs
Quote:
# Activate mod_includes
Options Includes
# Allow the XBitHack method of implementing SSIncludes.
What is your DocumentRoot? In Suse it should be /srv/www/htdocs, so make sure that you put the .htaccess in the correct directory
Then make also sure that your index page has the execute bit on, e.g. if it's index.html, what gives:
If your DocumentRoot is the default /srv/www/htdocs, then .htaccess should be placed in that directory.
I don't know what you mean by root/srv/www/htdocs. If that by any chance a subdir of your /root directory? If it is, the .htaccess is not read, so that's why SSI don't work.
If your DocumentRoot is the default /srv/www/htdocs, then .htaccess should be placed in that directory.
I don't know what you mean by root/srv/www/htdocs. If that by any chance a subdir of your /root directory? If it is, the .htaccess is not read, so that's why SSI don't work.
Other than that everything else looks fine.
.htaccess is in /srv/www/htdocs
/srv/www/htdocs is a subdirectory of root by definiton.
give it the execute bit and see if you get the date.
Or you can put some gibberish in .htaccess and see if you get a 500 error, meaning that apache reads .htaccess files
Regards
Well, I did those two things one after the other.
The Date function worked, so we know it's serving SSI code.
The gibberish in .htaccess generated a 500 error code, so it's reading that as well.
Then, just on general principle, I tried localhost again, and it correctly served the header and buttons via SSI !!
I can not think of what I may have done that it suddenly came good, but I am inclined to agree with you that it may have been a browser cache problem of some kind which has now cleared itself.
Both Firefox and Konqueror did the same thing, though, which is what had me looking for a code error.
Although totally baffled, the fact is, it is now working, so I propose to not look a gift horse in the mouth and stop right there.
Would I be right in thinking that the use of .htaccess files is good practice as they are always the last configuration file to be loaded ?
The use of .htaccess is necessary in a shared VPS environment. Other that that it's better to use the apache configuration file. Read this for more details
The use of .htaccess is necessary in a shared VPS environment. Other that that it's better to use the apache configuration file. Read this for more details
Regards
OK thanks. Will do.
Edit:
The first thing that says is
Quote:
You should avoid using .htaccess files completely if you have access to httpd main server config file. Using .htaccess files slows down your Apache server. Any directive that you can include in a .htaccess file is better set in a Directory block, as it will have the same effect with better performance.
But I have read elsewhere that the last thing you should do is edit httpd.conf as the consequences of a mistake can be disasterous in a production environment.
This doesn't overly concern me as my localhost is a pure test environment so I can make all the mistakes I want, up to and including a full apache reinstall without any problem.
It's just the intellectual satisfaction of understanding good practice and how things work.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.