gitweb + smart http

As the requirements for http-type push and pull, we must set up much more things. This post is a short report for how to set it up but discard the detail of how to install the packages.

1. git-http-backend:

As the resources from manual git-http-backend, we need to generate a configuration and its corresponding settings.

# vim /{the apache configs directory}/git-more.conf

And filled out settings like:

1
2
3
4
5
6
7
8
9
10
11
12
13
SetEnv GIT_PROJECT_ROOT {git repository root}
SetEnv GIT_HTTP_EXPORT_ALL

ScriptAliasMatch \
"(?x)^/git/(.*/(HEAD | \
info/refs | \
objects/(info/[^/]+ | \
[0-9a-f]{2}/[0-9a-f]{38} | \
pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
git-(upload|receive)-pack))$"
\
/{path to git-http-backend}/$1

ScriptAlias /git/ /{path to gitweb.cgi}/

And Don’t forget to enable the WebDav for the repositories directory, like:

1
2
3
4
5
<Directory "{repositories root}">
Options Indexes FollowSymlinks ExecCGI
Allow From All
Dav On
</Directory>

On the other hand, also the ExecCGI permission for the cgis. But there also problems when we use git push

Continue reading “gitweb + smart http”

mysql’s “SET NAMES”

One of my friend encounter a prblem after reconstruction of mysql server. The process is too detail and complex to write down that I only point out the result.

After surveying some resources of the “SET NAMES XXX” command for mysql connection, I realize that the charset settings of client, connection, server, and result are important for an old website. For eample, webpages use big5 but databases use big5 or other more strange settings.

From the resources: [轉載]MySQL 的 “SET NAMES xxx” 字元編碼問題分析, we can use the separate commands for more detail settings:

SET character_set_client = big5;
SET character_set_results = big5;
SET character_set_connection = utf8;

when the tables use utf8 but pages uses big5 and the server default settings are utf8.

Anyway, trying this solution if there is no other choices. 😀

bash_complete in gentoo

To enable this feature, gentoo will have come auto completion/notify for command. But in gentoo, there are some tricky should be note.

1. install gentoo-bashcomp, it will also imstall bash_completion and mush more syntax file

# emerge gentoo-bashcomp

2. enable the syntax of gentoo

# eselect bashcomp enable --global gentoo

3. for other syntax, IMPORTANT: the base must be enable by default

# eselect bashcomp enable --global base ssh info man

After enabling base and ssh, you can use ssh<TAB><TAB> to get the listing you have connected. And the man and info are also useful when we want to search for partial command. Enjoy it 😀

Switch the tomcat listings options

This post is about how to override default tomcat options for each apps. For the default settings we used for tomcat will listings the directories when there is no feasible welcome pages. But we want to do separate settings for each apps.

After some search, according to this page: EnablingOrDisablingDirectoryListingsUsingWeb.xml, the answer is clear. That is, opening the configure file (web.xml) in what we want set up, and add the corresponding  <servlet> and <servlet-mapping> section as the example below.

<servlet>
<servlet-name>DefaultServletOverride</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
<init-param>
<param-name>listings</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<!– Add a mapping for our new default servlet –>
<servlet-mapping>
<servlet-name>DefaultServletOverride</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>

Then finished.