Access Koha Staff/OPAC client over LAN network - lan

I've installed Koha 3.6 - as provided by Vimal Kumar on Ubuntu 10.04 LTS. This works excellently.
However, I want to access the web Staff/OPAC client via LAN, so that I can open the clients on another computer (Windows 7) in addition to accessing it on the Koha machine.
Vimal directed me to this website: http://kohageek.pbworks.com/w/page/51840331/Network%20Configuration
Here is a break down of the instructions, and what I did. This method failed, and I reverted my files back to their original content, and my Staff/OPAC clients work again now, but are still not accessible on LAN.
I've got a router for this, and I connected each computer to the router - they can see each other on the network.
1) sudo gedit /etc/hosts
Enter the IP Address and Fully Qualified Domain Name
My original file contains the following:
127.0.0.1 localhost
127.0.1.1 ansa-desktop
#The following lines are desirable for IPv6 capable hosts)
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
I replaced the top part with:
127.0.0.1 localhost
192.168.1.10 ansa-desktop
2) sudo gedit /etc/hostname
Enter the hostname of your system without domain name
My file contains the following:
ansa-desktop
I didn't make changes in this file - it look right to me.
3) In System --> Preferences -> Network Connections
Choose DHCP or Enter Static IP Number, subnet mask and gateway information
I chose the following:
IP: 192.168.1.10
Subnetmask:255.255.255.0
Gateway: 0.0.0.0 (automatically set)
4) sudo gedit /etc/koha/koha-httpd.conf
Change the IP number in OPAC and Intranet virtual host.
My original file contained the following and the IPs in bold was subsequently swapped with my selected static IP (192.168.1.10):
# Koha Apache Configuration Directives
#NameVirtualHost *
## OPAC
'<'VirtualHost 127.0.1.1:80>
ServerAdmin webmaster#koha-desktop
DocumentRoot /usr/share/koha/opac/htdocs
ServerName koha-desktop
# ServerAlias opac.mydomain.com
ScriptAlias /cgi-bin/koha/ "/usr/share/koha/opac/cgi-bin/opac/"
ScriptAlias /index.html "/usr/share/koha/opac/cgi-bin/opac/opac-main.pl"
ScriptAlias /opac-search.pl "/usr/share/koha/opac/cgi-bin/opac/opac-search.pl"
ScriptAlias /search "/usr/share/koha/opac/cgi-bin/opac/opac-search.pl"
ErrorLog /var/log/koha/koha-opac-error_log
# CustomLog /var/log/koha/koha-opac-access_log combined
# TransferLog /var/log/koha/koha-opac-access_log
SetEnv KOHA_CONF "/etc/koha/koha-conf.xml"
SetEnv PERL5LIB "/usr/share/koha/lib"
SetEnv MEMCACHED_SERVERS ""
SetEnv MEMCACHED_NAMESPACE ""
<IfModule mod_gzip.c>
mod_gzip_on yes
mod_gzip_dechunk yes
mod_gzip_keep_workfiles No
mod_gzip_can_negotiate yes
mod_gzip_update_static No
mod_gzip_temp_dir /tmp
mod_gzip_minimum_file_size 512
mod_gzip_maximum_file_size 1000000
mod_gzip_maximum_inmem_size 1000000
mod_gzip_handle_methods GET POST
mod_gzip_item_exclude reqheader "User-Agent: .*Mozilla/4\..*\["
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader Content-Type:image/*
mod_gzip_item_include file \.js$
mod_gzip_item_include mime ^application/javascript$
mod_gzip_item_include mime ^application/x-javascript$
mod_gzip_item_include file \.php$
mod_gzip_item_include mime ^text/html$
mod_gzip_item_include file \.css$
mod_gzip_item_include mime ^text/css$
</IfModule>
<IfModule mod_deflate.c>
# Compress content with type html, text, and css, ...
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
DeflateCompressionLevel 9
# Properly handle old browsers that do not support compression
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio
LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
<IfModule mod_headers.c>
#properly handle requests coming from behind proxies
Header append Vary User-Agent
</IfModule>
</IfModule>
# Repeat this virtualhost stanza changing the following environment vars to
# create multiple OPAC interfaces with custom css and/or search limits:
# SetEnv OPAC_CSS_OVERRIDE mystyle.css
# SetEnv OPAC_SEARCH_LIMIT branch:CODE
# SetEnv OPAC_LIMIT_OVERRIDE 1
Options +FollowSymLinks
ErrorDocument 400 /cgi-bin/koha/errors/400.pl
ErrorDocument 401 /cgi-bin/koha/errors/401.pl
ErrorDocument 403 /cgi-bin/koha/errors/403.pl
ErrorDocument 404 /cgi-bin/koha/errors/404.pl
ErrorDocument 500 /cgi-bin/koha/errors/500.pl
# Rewrite Rules
RewriteEngine On
# Uncomment to turn on rewrite logging
# RewriteLog /var/log/koha/koha-opac-rewrite.log
# RewriteLogLevel 1
RewriteCond %{QUERY_STRING} (.?)(?:[A-Za-z0-9_-]+)=&(.)
RewriteRule (.+) $1?%1%2 [N,R,NE]
RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/opac-detail\.pl?bib=$1 [PT]
RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
## Intranet
'<'VirtualHost 127.0.1.1:8080>
ServerAdmin webmaster#koha-desktop
DocumentRoot /usr/share/koha/intranet/htdocs
ServerName koha-desktop:8080
# ServerAlias intranet.mydomain.com
ScriptAlias /cgi-bin/koha/ "/usr/share/koha/intranet/cgi-bin/"
ScriptAlias /index.html "/usr/share/koha/intranet/cgi-bin/mainpage.pl"
ScriptAlias /search "/usr/share/koha/intranet/cgi-bin/search.pl"
ErrorLog /var/log/koha/koha-error_log
# TransferLog /var/log/koha/koha-access_log
SetEnv KOHA_CONF "/etc/koha/koha-conf.xml"
SetEnv PERL5LIB "/usr/share/koha/lib"
SetEnv MEMCACHED_SERVERS ""
SetEnv MEMCACHED_NAMESPACE ""
Options +FollowSymLinks
ErrorDocument 400 /cgi-bin/koha/errors/400.pl
ErrorDocument 401 /cgi-bin/koha/errors/401.pl
ErrorDocument 403 /cgi-bin/koha/errors/403.pl
ErrorDocument 404 /cgi-bin/koha/errors/404.pl
ErrorDocument 500 /cgi-bin/koha/errors/500.pl
<IfModule mod_gzip.c>
mod_gzip_on yes
mod_gzip_dechunk yes
mod_gzip_keep_workfiles No
mod_gzip_can_negotiate yes
mod_gzip_update_static No
mod_gzip_temp_dir /tmp
mod_gzip_minimum_file_size 512
mod_gzip_maximum_file_size 1000000
mod_gzip_maximum_inmem_size 1000000
mod_gzip_handle_methods GET POST
mod_gzip_item_exclude reqheader "User-Agent: .*Mozilla/4\..*\["
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader Content-Type:image/*
mod_gzip_item_include file \.js$
mod_gzip_item_include mime ^application/javascript$
mod_gzip_item_include mime ^application/x-javascript$
mod_gzip_item_include file \.php$
mod_gzip_item_include mime ^text/html$
mod_gzip_item_include file \.css$
mod_gzip_item_include mime ^text/css$
</IfModule>
<IfModule mod_deflate.c>
# Compress content with type html, text, and css, ...
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
DeflateCompressionLevel 9
# Properly handle old browsers that do not support compression
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio
LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
<IfModule mod_headers.c>
#properly handle requests coming from behind proxies
Header append Vary User-Agent
</IfModule>
</IfModule>
RewriteEngine On
# Uncomment to turn on rewrite logging
# RewriteLog /var/log/koha/koha-intranet-rewrite.log
# RewriteLogLevel 1
RewriteCond %{QUERY_STRING} (.*?)(?:[A-Za-z0-9_-]+)=&(.*)
RewriteRule (.+) $1?%1%2 [N,R,NE]
RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/detail\.pl?bib=$1 [PT]
RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
servername localhost
5) Restart Apache /etc/init.d/apache2 restart
This failed (I forgot the error message, but can recreate it if required).
I also have Webmin installed and configured, as part of the Koha install - if this should be relevant.
I have also looked at this article, but couldn't gleam from it a resolve for my problem:stackoverflow article
If anyone can tell me why this didn't work and how to make it work, I would really appreciated it.
Thanks
Jurgens

This isn't a koha specific question at all. It is how to get your apache server answering on your LAN.
First off do an sudo ifconfig
To find out what the IP of your server is. Then set apache up to listen on that address.
There is nothing special about Koha in this regards, it is just a website. So you just need apache2 answering on the IP number that is on your LAN. Not 127.0.0.1
Also webmin is not needed by Koha

You really dont need all these configurations, if you used the live dvd everything has been configured on it.
All you need to do is to go to your terminal and run an ifconfig to see the ip address on your machine, it is this ip address that you will enter in the address bar on all other systems and they will see your Koha.

Please do check if you have the same network on both of your koha server and client computer... In our case, koha is accessible via LAN using its ip addresses.
you may also need to check the network configuration itself. for example, if your client pc cannot ping any request to the koha server then your network configuration might be the problem.
our koha work over LAN without any configuration on "koha-httpd.conf".

Related

How to use gzip and http2 at the same time?

I'm doing webgl and use .ktx, a format extremly heavy when not gzipped.
The result of the loading size using http2 or http1.1 :
https + http2 : 98mo, gzip doesnt work
http + http1.1 : 12mo, gzip work.
I was wondering if it was possible to use gzip and http2 at the same time?
In case, here my .htaccess ( relevant part ) :
<IfModule mod_mime.c>
AddType model/gltf+json .gltf
AddType image/ktx .ktx
</Ifmodule>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE "model/gltf+json" \
"image/ktx"
</IfModule>
There is nothing to stop you using gzip and http2 at the same time.
I can only guess you have the mod_deflate config only setup in your http vhost and not the https vhost.

Responding to google page speed suggestion regarding compression

Google page speed tool tells me this: "Compressing resources with gzip or deflate can reduce the number of bytes sent over the network"
and of course lists all my .js and .css files.
Researching here eventually led me to this question:
How to Specify "Vary: Accept-Encoding" header in .htaccess
Which seems to say that for just .js and .css files all I would need to do is this:
<IfModule mod_deflate.c>
#The following line is enough for .js and .css
AddOutputFilter DEFLATE js css
</IfModule>
<IfModule mod_headers.c>
<FilesMatch "\.(js|css)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
Can someone confirm that this is the current "best practice" for this objective and that it is failsafe, assuming the user is on a modern browser (e.g. not < IE7 for example)
Thanks!

.htaccess - Cache files from URL like /files/large/6

We have a multisite CMS that handles images and other files like this..
How can we cache images and other files that are in www.(or non-www.)variable-domain.com/files/* with .htaccess?
This is causing a 500 error. I stripped out some.. here is what I have currently that works (minus the Directory and contents part - it throws the error when thats included).
#
# Force Browser Cache
#
<ifmodule mod_expires.c>
ExpiresActive On
<filesmatch "\.(jpg|gif|png|css|js)$">
ExpiresDefault "access plus 1 year"
</filesmatch>
<FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
<FilesMatch ".(js|css|pdf|txt)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
<Directory "/home/aiwebsystems/public_html/uploads">
<FilesMatch "\.(gif|jpg|png|js|css)$">
ExpiresDefault "access plus 1 year"
</FilesMatch>
</Directory>
</ifmodule>
I would need all subdirectories of this included too...
Thanks for the help!
Use Apache's mod_expires
e.g in your .htaccess put:
ExpiresActive On
<Directory "/path/to/public_html/files">
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
ExpiresDefault A300
<FilesMatch "\.html$">
Expires A86400
</FilesMatch>
<FilesMatch "\.(gif|jpg|png|js|css)$">
Expires A2592000
</FilesMatch>
</Directory>
A300 meaning that the user cached copy expires 300 seconds after access. (A86400 is a day after access, A2592000 is a month after access)
If you mean server side caching, well then you are in luck as the operating system caches recently using a 'paging' algorithm: http://en.wikipedia.org/wiki/Paging
<Directory> is not allowed in htaccess.
Just create a new .htaccess file, with the expires stuff, and put it inside the 'uploads' directory. This will have the same effect you try to achief
Being as it does not have an extension, none of this worked. I change the code in the end and it works great now, using the file name rather than the image ID as the last URI parameter.

How to Specify "Vary: Accept-Encoding" header in .htaccess

Google PageSpeed says I should "Specify a Vary: Accept-Encoding header" for JS and CSS. How do I do this in .htaccess?
I guess it's meant that you enable gzip compression for your css and js files, because that will enable the client to receive both gzip-encoded content and a plain content.
This is how to do it in apache2:
<IfModule mod_deflate.c>
#The following line is enough for .js and .css
AddOutputFilter DEFLATE js css
#The following line also enables compression by file content type, for the following list of Content-Type:s
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml
#The following lines are to avoid bugs with some browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>
And here's how to add the Vary Accept-Encoding header: [src]
<IfModule mod_headers.c>
<FilesMatch "\.(js|css|xml|gz)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
The Vary: header tells the that the content served for this url will vary according to the value of a certain request header. Here it says that it will serve different content for clients who say they Accept-Encoding: gzip, deflate (a request header), than the content served to clients that do not send this header. The main advantage of this, AFAIK, is to let intermediate caching proxies know they need to have two different versions of the same url because of such change.
I'm afraid Aularon didn't provide enough steps to complete the process. With a little trial and error, I was able to successfully enable Gzipping on my dedicated WHM server.
Below are the steps:
Run EasyApache within WHM, select Deflate within the Exhaustive Options list, and rebuild the server.
Once done, goto Services Configuration >> Apache Configuration >> Include Editor >> Post VirtualHost Include, select All Versions, and then paste the mod_headers.c and mod_headers.c code (listed above in Aularon's post) on top of on another within the input field.
Once saved, I was seeing a 75.36% data savings on average! You can run a before and after test by using this HTTP Compression tool to see your own results: http://www.whatsmyip.org/http_compression/
Hope this works for you all!
Matt
To gzip up your font files as well!
add "x-font/otf x-font/ttf x-font/eot"
as in:
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml x-font/otf x-font/ttf x-font/eot
This was driving me crazy, but it seems that aularon's edit was missing the colon after "Vary". So changing "Vary Accept-Encoding" to "Vary: Accept-Encoding" fixed the issue for me.
I would have commented below the post, but it doesn't seem like it will let me.
Anyhow, I hope this saves someone the same trouble I was having.
Many hours spent to clarify what was that. Please, read this post to get the advanced .HTACCESS codes and learn what they do.
You can use:
Header append Vary "Accept-Encoding"
#or
Header set Vary "Accept-Encoding"
if anyone needs this for NGINX configuration file here is the snippet:
location ~* \.(js|css|xml|gz)$ {
add_header Vary "Accept-Encoding";
(... other headers or rules ...)
}
No need to specify or even check if the file is/has compressed,
you can send it to every file, On every request.
It tells downstream proxies how to match future request headers to decide
whether the cached response can be used rather than requesting a fresh
one from the origin server.
<ifModule mod_headers.c>
Header unset Vary
Header set Vary "Accept-Encoding, X-HTTP-Method-Override, X-Forwarded-For, Remote-Address, X-Real-IP, X-Forwarded-Proto, X-Forwarded-Host, X-Forwarded-Port, X-Forwarded-Server"
</ifModule>
the unset is to fix some bugs in older GoDaddy hosting, optionally.

How do I enable gzip on Dreamhost?

I would like to compress all css and js on my Dreamhost site, I have found suggestions on the web but none of them work. Does anyone have a working example of gzip running on a Dreamhost site?
I'm a bit late to the game here in 2012, but I think this is still relevant. The "mod_gzip" method does not work in Dreamhost's .htaccess files any more. They seem to be using mod_deflate instead.
I removed the mod_gzip block and added the following to my .htaccess file:
AddOutputFilterByType DEFLATE text/html text/plain application/javascript text/css
This did the trick for me. You can also add other file types here in case you have things like XML or JSON - or something that falls outside the norm.
I've gone back and updated the Dreamhost wiki page to add this.
I haven't tried this yet. But, it might work
<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl|jpg|png|gif)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>
Source: http://wiki.dreamhost.com/Htaccess_tricks
This thread on the Dreamhost support forum looks like it has the info you want.

Resources