Linux chkconfig 命令的使用

Linux chkconfig 命令的使用

1.命令简介chkconfig 命令用于更新和查询系统服务的运行等级信息。它可查询操作系统在每一个运行等级中会自动执行哪些系统服务,包括各类常驻服务,比如 httpd、sshd、mysqld 等。
如何在Linux环境为用户添加sudo权限

如何在Linux环境为用户添加sudo权限

sudo的配置文件 sudo默认配置文件是**/etc/sudoers** ,一般使用Linux指定编辑工具visudo ,此工具的好处是可以进行错误检查。在添加规则不符合语法规则时,保存退出时会提示给我们错误信息;配置好后,可以用切换到您授权的普通用户下,通过sudo -l来查看哪些命令是可以执行的或禁止的;
改版时保留原链接,创建新的URL的方法

改版时保留原链接,创建新的URL的方法

具体操作办法(仅适用于apache网络服务器): 文件位置:apache->conf->httpd.conf 请在httpd.conf中使用Alias指令: Alias /newurl /www/htdocs/oldurl 如:用户访问新的地址example.com/newurl/id34.html 服务器将提供的内容原地址是example.com/www/htdocs/oldurl/ ···
Linux下截屏并编辑的最佳工具

Linux下截屏并编辑的最佳工具

当我的主力操作系统从 Windows 转换到 Ubuntu 的时候,首要考虑的就是屏幕截图工具的可用性。尽管使用默认的键盘快捷键也可以获取屏幕截图,但如果使用屏幕截图工具,可以更方便地对屏幕截图进行编辑。
linux URL的301重定向代码分析

linux URL的301重定向代码分析

所以凡是使用linux的主机,我都会定义个301重定向,以利于SEO。昨天照例把htaccess传到服务器上,没想到传上后网站无法访问,一删除就恢复正常。看了很多遍代码,也没发现什么问题。 干脆就重新学习下URL重写方法。规范化URL描述:在有些web服务器上,一个资源会拥有多个URL。在实际应用和发布中应该使用的是规范的URL,其他的则是简写或者只在内部使用。无论用户在请求中使用什么形式的URL,最终看见的都应该是规范的URL。解决方案:对所有不规范的URL执行一个外部HTTP重定向,以改变它在浏览器地址栏中的显示及其后继请求。下例中的规则集用规范的/u/user替换/~user,并修正了/u/user所遗漏的后缀斜杠。RewriteRule ^/~([^/]+)/?(.*) /u/$1/$2 [R]RewriteRule ^/([uge])/([^/]+)$ /$1/$2/ [R]
apache虚拟主机配置一例

apache虚拟主机配置一例

代码如下:fivetrees extra # cat httpd-vhosts.conf_bak## Virtual Hosts## 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.## Use name-based virtual hosting.#NameVirtualHost *:80#NameVirtualHost *:443## VirtualHost example:# Almost any Apache directive may go into a VirtualHost container.# The first VirtualHost section is used for all requests that do not# match a ServerName or ServerAlias in any <VirtualHost> block.##<VirtualHost 192.168.1.66>#        RewriteEngine On#        RewriteMap      lowercase       int:tolower#        RewriteMap      vhost   txt:/usr/local/apache/conf/host.txt#        RewriteCond     %{HTTP_HOST}    !^$#        RewriteCond     ${lowercase:%{HTTP_HOST}|NONE}  ^(.+)$#        RewriteRule     ^/(.*...)$ ${vhost:%1...}/$1#</VirtualHost><VirtualHost *:80>        DocumentRoot /opt/all_dir        ServerName *</VirtualHost><VirtualHost *:80>        DocumentRoot /opt/1        ServerName 1.com</VirtualHost><VirtualHost *:80>        DocumentRoot /opt/2        ServerName 2.com</VirtualHost>