分類
Linux 网站

Apache限制IP访问

只需在配置文件中添加如下代码即可:

<Location />
Order Allow,Deny
Allow from localhost
Deny from 192.168.1.*
</Location>

我的配置文件位于/etc/apache2/sites-enabled/000-default。将上面Location节点放在VirtualHost节点内即可。其实现的效果是除本机外其他局域网主机都无法访问站点。

重启Apache时提示Could not reliably determine the server's fully qualifieddomain name可以通过在/etc/apache2/httpd.conf中添加一行ServerName localhost来解决。

最后在记一下修改Ubuntu hosts文件方法:

  1. 打开hosts文件:sudo gedit /etc/hosts
  2. 添加一行:127.0.0.1 localhost
  3. 重启网络:sudo /etc/init.d/networking restart

比较遗憾的是host文件并不支持通配符。

分類
Linux

Ubuntu安装fcitx中文输入法

听说fcitx中文输入法是较为先进的中文输入法,而且拥有相对漂亮的皮肤,当然亮点还是能支持云输入法,众多优点当然要试一下啦。要安装fcitx中文输入法,依此在终端执行如下命令:

<code>sudo add-apt-repository ppa:wengxt/fcitx-nightly</code>
<code>sudo apt-get update</code>
<code>sudo apt-get install fcitx fcitx-config-gtk fcitx-sunpinyin</code>
<code>sudo apt-get install fcitx-table-all</code>

下面两条命令是可选的,第一个是设置fcitx为默认输入法,第二个是为防止乱码所安装的uming字体。

<code>im-switch -s fcitx -z default</code>
<code>sudo apt-get install ttf-arphic-uming</code>

最后需要重启生效。如果没有中文输入法出现,可以在Configuation里点“+”,然后反选Only Show Current Language,在下面输入框里输pinyin就可以添加中文输入法了。默认Ctrl+Space切换输入法,Shift切换语言,中文下按Enter输入英文。

分類
Linux

VirtualBox更新扩展错误

在window xp下更新了Virtual Box,但是在更新扩展包是遇到了如下错误:

Failed to install the extension. The installer failed with exit code 1: VBoxExtPackHelperApp.exe: error: Failed to rename the extension pack directory: VERR_ALREADY_EXISTS.

解决办法如下:首先关闭Virtual Box,然后进入命令行,切换到Virtual Box的安装目录,如D:Program FilesOracleVirtualBox,然后运行下

vboxmanage extpack cleanup

这样问题就解决了。另外的我的扩展包默认是下载在C:Documents and SettingsAdministrator.VirtualBox里面的,直接双击就能安装了。

分類
Linux

Ubuntu更新软件源

首先备份下旧源:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

然后替换源:

sudo nano /etc/apt/sources.list

一个源:

deb http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-proposed main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-proposed main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
分類
Linux

PuTTY

PuTTY is an SSH and telnet client, developed originally by Simon Tatham for the Windows platform. PuTTY is open source software that is available with source code and is developed and supported by a group of volunteers.

直接下载putty.exe就可以在Windows上方便的ssh连接远程的Linux主机了。但是要从Windows传文件给Linux的话,就还需要下载pscp.exe。最好把它放在C:WINDOWSsystem32中,这样就能直接在终端使用pscp命令了。来个示例:

C:Documents and SettingsAdministrator>pscp F:/eula.1028.txt [email protected]:/tmp
分類
Linux 软件

Ubuntu下Chromium与Opera

对比来对比去还是Opera好用!

Chromium Opera
不同设备同步书签和密码 [1]
HTML5支持
页面分析工具
开源软件
右键查看图片详情
插件支持 [2]
页面定时自动刷新 通过插件实现
页面内容拦截 通过插件实现[3]
方便的从缓存中提取资源 [4]
1G内存下崩溃率 经常[5] 极少
分類
Linux 软件

J7Z-Linux下的7ZGUI

#用命令行工具生成加密了文件名的壓縮文件
7z a -p -mx=9 -mhe -t7z 目標.7z 待壓縮文件1.txt 待壓縮文件2.txt
#參數解釋
a: 添加文件到存檔
-p: 彈出密碼提示
-mx=9: 壓縮等級 (9 爲最大)
-mhe: 加密文件名
-t7z: 生成一個 7z 存檔

#用命令行工具解壓 7z 存檔
7za e 目標.7z

ubuntu下的图形压缩软件选项太简陋了,想“仅储存“的压缩都不行,命令行实在是不方便。J7Z提供了解决方法。

首先安装7z,

sudo apt-get install p7zip-full
#最好也安装下rar支持
sudo apt-get install p7zip-rar

然后到谷歌代码J7Z项目SourceForgeJ7Z项目下载J7Z-1.2.0-src.tar.bz2。解压后切换到Build目录,然后运行make,最后再运行sudo make install即可。你会发现右键里多了个script,那里就可以压缩解压了。

本文更新於 2021/01/31。