webserver apache 2.2.22-7/ apache webdav / redhat 6.3
s
问题1:Failed to resolve server name for 10.24.41.161 (check DNS) / RedHat 6.3 64位系统 / apache http 2.2.22-7
[davadmin@sctsdemo webroot]$ /opt/apache/bin/httpd -k start
[Wed Aug 23 21:31:06 2017] [error] (EAI 2)Name or service not known: Failed to resolve server name for 10.24.41.161 (check DNS) -- or specify an explicit ServerName
解决1:
新增配置 /etc/hosts 自解析DNS的ip地址即可。
问题2:使用root赋权davadmin用户使用apache整个目录,准备启动apache 2.2.22-7,报错如下:
[davadmin@sctsdemo logs]# chown -R davadmin.davadmin /opt/apache
[davadmin@sctsdemo logs]# chmod 755 -R /opt/apache
[davadmin@sctsdemo logs]# su - davadmin
[davadmin@sctsdemo logs]$ id
uid=504(davadmin) gid=504(davadmin) groups=504(davadmin) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 [davadmin@sctsdemo logs]$ /opt/apache/bin/httpd -k start
(13)Permission denied: make_sock: could not bind to address [::]:80
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
解决2:
Linux普通用户使用sudo权限启停apache服务
http://www.cnblogs.com/abclife/p/5028885.html
sudo的工作过程如下:
1,用户执行sudo时,系统会主动寻找/etc/sudoers文件,判断该用户是否有执行sudo的权限
2,确认用户具有可执行sudo的权限后,让用户输入密码确认
3,若密码输入成功,则开始执行sudo后续的命令
4,root执行sudo时不需要输入密码(对应配置文件中"root ALL=(ALL) ALL"这样一条规则)
5,若欲切换的身份与执行者的身份相同,也不需要输入密码
使用VIM编辑/etc/sudoers,或者直接使用visudo编辑sudo规则
添加一条规则:
user01 ALL=(root) /etc/init.d/httpd
如果不想每次都要输入密码,可以进行以下设置:
user01 ALL=(root)NOPASSWD: /etc/init.d/httpd
修改范例二
# tangxje start 20170824
davadmin ALL=(root)NOPASSWD: /opt/apache/bin/httpd
# tangxje end 20170824
Redhat 6.3 64位关闭SELinux和防火墙的办法
http://blog.csdn.net/superbfly/article/details/49125125
Redhat使用了SELinux来增强安全,关闭的办法为:
1. 永久有效
修改 /etc/selinux/config 文件中的 SELINUX="" 为 disabled ,然后重启。
2. 即时生效
setenforce 0
关闭防火墙的方法为:
1. 永久性生效
开启:chkconfig iptables on
关闭:chkconfig iptables off
2. 即时生效,重启后失效
开启:service iptables start
关闭:service iptables stop
需要说明的是对于 Linux 下的其它服务都可以用以上命令执行开启和关闭操作
补充:
a. 防火墙还需要关闭ipv6的防火墙:
chkconfig ip6tables off
并且可以通过如下命令查看状态:
chkconfig --list iptables
b. selinux状态可以通过以下命令查看:
sestatus
[root@sctsdemo opt]# more /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1 sctsdemo sctsdemo.cnsuning.com
10.24.41.161 sctsdemo sctsdemo.cnsuning.com 此为新增配置
Linux下不重启永久修改hostname / 适用于RedHat 6.3 / CentOS 6.3系统,不适用于RedHat 7.3 / CentOS 7.3系统
http://blog.csdn.net/sz_bdqn/article/details/46554717
Linux下不重启永久修改hostname
1、如果只是修改hostname可以通过如下命令
hostname newHostname
注意:这种修改方式只有当前有效,等服务器重启后hostname就会失效,回到原来的hostname。
2、如果需要永久修改hostname可通过如下命令
vi /etc/sysconfig/network
修改其中的HOSTNAME项,不过此种方法需要重启后生效。
3、于是在不重启又能永久修改hostname的方式是结合上述两种,这样便能做到不用重启当前也生效,重启后也生效。
使用 Apache Jackrabbit 实现 WebDAV 客户端
https://www.ibm.com/developerworks/cn/java/j-lo-jackrabbit/
import java.io.FileInputStream;
import java.io.IOException; import org.apache.commons.httpclient.Credentials;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.StatusLine;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
import org.apache.commons.httpclient.methods.RequestEntity;
import org.apache.jackrabbit.webdav.DavConstants;
import org.apache.jackrabbit.webdav.DavException;
import org.apache.jackrabbit.webdav.MultiStatus;
import org.apache.jackrabbit.webdav.MultiStatusResponse;
import org.apache.jackrabbit.webdav.client.methods.CopyMethod;
import org.apache.jackrabbit.webdav.client.methods.DavMethod;
import org.apache.jackrabbit.webdav.client.methods.DeleteMethod;
import org.apache.jackrabbit.webdav.client.methods.LockMethod;
import org.apache.jackrabbit.webdav.client.methods.MkColMethod;
import org.apache.jackrabbit.webdav.client.methods.MoveMethod;
import org.apache.jackrabbit.webdav.client.methods.PropFindMethod;
import org.apache.jackrabbit.webdav.client.methods.PutMethod;
import org.apache.jackrabbit.webdav.client.methods.UnLockMethod;
import org.apache.jackrabbit.webdav.lock.Scope;
import org.apache.jackrabbit.webdav.lock.Type; public class DavClient { public static void main(String [] args) throws IOException, DavException { HttpClient client = new HttpClient();
Credentials creds = new UsernamePasswordCredentials("admin", "passw0rd");
client.getState().setCredentials(AuthScope.ANY, creds); // MKCOL method - 新建目录
DavMethod mkCol = new MkColMethod("http://127.0.0.1/uploads/test");
client.executeMethod(mkCol); int statusCode = mkCol.getStatusCode();
String statusText = mkCol.getStatusText();
StatusLine statusLine = mkCol.getStatusLine();
System.out.println("mkcol test folder:" + statusCode + " " + statusText);
System.out.println(statusLine.toString()); // Put Method - 上传本地文件
PutMethod put = new PutMethod("http://127.0.0.1/uploads/test/lena.jpg");
RequestEntity requestEntity = new InputStreamRequestEntity(new FileInputStream("lena.jpg"));
put.setRequestEntity(requestEntity);
client.executeMethod(put);
System.out.println("put image file:" + put.getStatusCode() + " " + put.getStatusText()); // CopyMethod(String uri, String destinationUri, boolean overwrite) - 远程拷贝本文
DavMethod copy = new CopyMethod("http://127.0.0.1/uploads/test/lena.jpg",
"http://127.0.0.1/uploads/test/lena2.jpg", true);
client.executeMethod(copy);
System.out.println("copy image file:" + copy.getStatusCode() + " " + copy.getStatusText()); //MoveMethod(String uri, String destinationUri, boolean overwrite) - 远程重命名文件
DavMethod move = new MoveMethod("http://127.0.0.1/uploads/test/lena.jpg",
"http://127.0.0.1/uploads/test/lena3.jpg", true);
client.executeMethod(move);
System.out.println("move image file:" + move.getStatusCode() + " " + move.getStatusText()); //LockMethod(String uri, Scope lockScope, Type lockType, String owner, long timeout, boolean isDeep) - 文件加锁操作
LockMethod lock = new LockMethod("http://127.0.0.1/uploads/test/lena.jpg", Scope.SHARED, Type.WRITE, "admin",
10000l, false);
client.executeMethod(lock);
String lockToken = lock.getLockToken();
System.out.println("lock image file:" + lock.getStatusCode() + " " + lock.getStatusText()); //UnLockMethod(String uri, String lockToken) - 文件解锁操作
DavMethod unlock = new UnLockMethod("http://127.0.0.1/uploads/test/lena.jpg", lockToken);
client.executeMethod(unlock);
System.out.println("unlock image file:" + unlock.getStatusCode() + " " + unlock.getStatusText()); // Find Method - 查找文件操作
DavMethod find = new PropFindMethod("http://127.0.0.1/uploads/test/", DavConstants.PROPFIND_ALL_PROP,
DavConstants.DEPTH_1);
client.executeMethod(find);
MultiStatus multiStatus = find.getResponseBodyAsMultiStatus();
MultiStatusResponse [] responses = multiStatus.getResponses();
System.out.println("Folders and files:");
for (int i = 0; i < responses.length; i++) {
System.out.println(responses[i].getHref());
} // Delete Method - 删除远程文件
DavMethod delete = new DeleteMethod("http://127.0.0.1/uploads/test/");
client.executeMethod(delete);
System.out.println("delete test folder:" + delete.getStatusCode() + " " + delete.getStatusText()); } }
[davadmin@sctspreapp03 testwa-cst]$ more /data/find.txt
移走文件服务器里文件夹大于300天的,减少磁盘空间
/opt/webdav/files/snapshot
/opt/webdav/files/testwa-cst
# find ./ -maxdepth 1 -mtime +300 -type d | xargs -I {} mv {} /data/snapshot300day/
end
webserver apache 2.2.22-7/ apache webdav / redhat 6.3的更多相关文章
- Atitit. 软件GUIbutton与仪表盘--webserver区--获取apache配置文件路径 linux and apache的启动、停止、重新启动
Atitit. 软件GUIbutton与仪表盘--webserver区--获取apache配置文件路径 linux and apache的启动.停止.重新启动 能够通过"netstat ...
- Hive JDBC:java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: root is not allowed to impersonate anonymous
今天使用JDBC来操作Hive时,首先启动了hive远程服务模式:hiveserver2 &(表示后台运行),然后到eclipse中运行程序时出现错误: java.sql.SQLExcepti ...
- Hive执行count函数失败,Caused by: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.AccessControlException)
Hive执行count函数失败 1.现象: 0: jdbc:hive2://192.168.137.12:10000> select count(*) from emp; INFO : Numb ...
- spark mllib配置pom.xml错误 Multiple markers at this line Could not transfer artifact net.sf.opencsv:opencsv:jar:2.3 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org
刚刚spark mllib,在maven repository网站http://mvnrepository.com/中查询mllib后得到相关库的最新dependence为: <dependen ...
- apache支持中文域名绑定,apache支持中文域名绑定,教你怎样让apache支持中文域名绑定
摘要:apache支持中文域名绑定,apache支持中文域名绑定,教你怎样让apache支持中文域名绑定,根据本人实际经验,叫你如何让apache支持中文域名绑定,绝对管用的让apache支持中文域名 ...
- Hbase 配置问题(ERROR: org.apache.hadoop.hbase.PleaseHoldException: org.apache.hadoop.hbase.PleaseHoldEx)
ERROR: org.apache.hadoop.hbase.PleaseHoldException: org.apache.hadoop.hbase.PleaseHoldException: Mas ...
- ZooKeeper - Perl bindings for Apache ZooKeeper Perl绑定用于 Apache ZooKeeper
ZooKeeper - Perl bindings for Apache ZooKeeper Perl绑定用于 Apache ZooKeeper 监控 master/slave 需要使用zk的临时节点 ...
- Caused by: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.AccessControlException):
用windows连接hadoop集群执行mapreduce任务的时候出现以下错误: org.apache.hadoop.security.AccessControlException:Permissi ...
- 一脸懵逼加从入门到绝望学习hadoop之 org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.AccessControlException): Permission denied: user=Administrator, access=WRITE, inode="/":root:supergroup:drwxr-xr报错
1:初学hadoop遇到各种错误,这里贴一下,方便以后脑补吧,报错如下: 主要是在window环境下面搞hadoop,而hadoop部署在linux操作系统上面:出现这个错误是权限的问题,操作hado ...
- 关于第一次在IED(MyEclipse)部署Maven时,pom.xml头部报这样的错---org.apache.maven.archiver.MavenArchiver.getManifest(org.apache.maven.project.MavenProject, org.apache.maven.archiver.MavenArchiveConfiguration)
rg.apache.maven.archiver.MavenArchiver.getManifest(org.apache.maven.project.MavenProject, org.apache ...
随机推荐
- JAVA SOCKET编程单线程简单实例
服务端: package socketProgram; import java.io.BufferedReader;import java.io.IOException;import java.io. ...
- Sprint 冲刺第三阶段第二天
陈汝婷:播放音乐 1:做播放音乐这个功能时开始没有考虑周全,使用 PS P出来的图竟然没有用上,耗时耗人工.吃一见长一智,以后要考虑周全.还要耗了那么久,音乐的初效果终于出来了. 2:昨天出现的问题, ...
- 毕业设计心得与整理-APP-主题切换
1.定义主体颜色: 在style自定义了三个属性: <item name="textLight">@android:color/white</item> & ...
- Neo4j学习案例【转】
转自 打怪的蚂蚁 CSDN: https://blog.csdn.net/xgjianstart/article/details/77285334 neo4j有社区版本和企业版.社区版本是免费的,只支 ...
- 2017BUAA软工个人作业Week1
大概的功能已经满足 暂时只能用debug中的exe文件 正在改进... https://github.com/qwellk/project1/tree/product1 PSP2.1 Personal ...
- shell脚本--输入与输出
输出带有转义字符的内容 单独一个echo表示一个换行 使用echo输出时,每一条命令之后,都默认加一个换行:要想取消默认的换行,需要加 -n 参数. #!/bin/bash #文件名:test.sh ...
- HDU 2033 人见人爱A+B
http://acm.hdu.edu.cn/showproblem.php?pid=2033 Problem Description HDOJ上面已经有10来道A+B的题目了,相信这些题目曾经是大家的 ...
- python pip包安装以及几个包的简单用法
1. centos74 安装完之后默认有python2.7.5 但是没有pip需要自己安装: copy from https://www.cnblogs.com/rain124/p/6196053.h ...
- DispatcherServlet源码分析
一.客户端发送请求的总体过程 DispatcherServlet是SpringMVC的入口,DispatcherServlet其实也是一个Servlet.服务器处理客户端请求的步骤如下: 1.客户端发 ...
- Jquery 组 radio控与tr变色
<!DOCTYPE html><html lang="zh-cn"><head> <meta charset="utf-8&qu ...