Linux

用.htaccess设置禁止显示Apache目录列表

注意:使用此方法不当时,设置的.htaccess文件会引起403 Forbidden 禁止访问的问题 如何禁止 Apache 显示目录列表呢? 缺省情况下如果你在浏览器输入地址:http://localhost:8080/ 并且你将你的目录索引文件设置为 index.html,且你的文件根目录里有 index.html,浏览器就会显示 index.html的内容,如果没有 index.html,浏览器就会显示文件根目录的目录列表,目录列表包括文件根目录下的文件和子目录。(注:索引文件的设置:)#在这里,你可以设置某个目录被请求时,首先执行的文件 同样你输入一个虚拟目录的地址:http://localhost:8080/b/ 如果该虚拟目录下没有 index.html,浏览器也会显示该虚拟目录的目录结构,列出该虚拟目录下的文件和子目录。 如何禁止 Apache 显示目录列表呢? 在 httpd.conf文件里找到类似这样指令: 将指令作这样的修改: 方法一:在Options Indexes FollowSymLinks在Indexes前面加...

How to flush the local DNS cache in Fedora?

You can flush your local DNS cache in Linux by following these easy steps: 1. Open your terminal to use the command line. 2. Log in as root using the su command: user@host:~$ su Password: root@host: 3. Restart the name service cache daemon: root@host: /etc/init.d/nscd restart Please note that the name service cache deamon (nscd) may not be installed by default on your Linux distribution. You should be able to install it through the package manager of your distribution – yum f...

Linux下禁用、启用SeLinux

一些Linux默认都是启用SeLinux的,在安装操作系统的时候我们可以选择开启或者关闭SeLinux,但是在安装完系统之后又如何开启与关闭呢? 在/etc/sysconf下有一个SeLinux文件,使用vi打开,更改其中的SELINUX项的值就可以了。 SELINUX=disable 禁用SeLinux SELINUX=enforcing 使用SeLinux 关闭SELinux 1. 无须重起而暂时关闭SELinux 以root用户运行以下命令 这条命令的作用是把SELinux暂时设定成Permissive模式(关于Permissive Mode在以下会有介绍) 如果要恢复运行SELinux则可以运行 这条命令会把SELinux设定成Enforcing模式 2. 把SELinux永久设定为Permissive模式 这里需要讲一下Permissive和Enforcing模式的区别。 SELinux有三种模式:Enforcing, Permissive and Disable. Enforcing模式...

.htaccess not working on apache web server

Q: I already enabled mod_rewrite in httpd.conf file on apache server, but .htaccess configuration is not working at all. How can i fix this problem? A: Make sure AccessFileName set to .htaccess Search httpd.conf for AccessFileName directive. It defines name of the distributed configuration file: Make sure users are allowed to use .htaccess file What you can put in these files is determined by the AllowOverride directive. This directive specifies, in categories, what directives will be...

How to set up A Records and MX Records

URL FORWARDING RECORDS HOST NAME TYPE DATA yourdomain.com Forward (F) http://www.someplace.com www.yourdomain.com Forward (F) http://www.someplace.com URL Forwarding records are used to redirect domains to another URL. A common purpose is to point a domain to a website or page hosted elsewhere which usually has a longer URL such as http://www.myispsite.com/~myname.html. Keep in mind that the DATA part of the forwarding record must be a complete URL like...

Search for text in vi or vim

vi and vim have powerful searching capabilities because they bring to bear the richness of regular expressions. To search for the next occurence of the text ‘maybe’ from the current cursor position, type: Search backward from the current position by using ? instead of / in the command. Once you have searched for something, you can find the next occurrence by pressing n or the previous occurrence with N. Searching in vi/vim is enhanced with regular expressions. For example, ...

How to excluding directories when zip files on Linux

All you needs is use the -x switch and list the files and directories to be excluded, separated by spaces. For example: