使用源代码编译方式安装Nginx的时候,肯定不如用用yum方式安装来得便捷,CentOS的系统服务需要自行配置。 自行配置Nginx为CentOS的系统服务时,出于进程管理考虑需要首先配置pid,出于安全考虑建议修改nginx的运行用户。 创建nginx.pid文件用于nginx主进程 touch /usr/local/nginx/logs/nginx.pid 修改conf/nginx.conf,设置pid和user user nobody; pid logs/nginx.pid; CentOS6.x配置nginx系统服务 创建一个/etc/init.d/nginx文件 touch /etc/init.d/nginx chmod 755 /etc/init.d/nginx /etc/init.d/nginx文件中写入以下内容, 源文件取自yum方式安装后的文件,不过需要自己修改一下nginx的指向位置 nginx=”/usr/local/nginx/sbin/nginx” NGINX_CONF_FILE=”/usr/local/nginx/conf/nginx.conf”
Monthly Archives: September 2017
Tomcat进程无法正常stop问题
CentOS使用Catalina.sh 来管理Tomcat运行时,Catalina.sh run 之后产生的tomcat进程会无法使用 Catalina.sh stop -force关闭。如果Catalina.sh的默认内容来配置tomcat服务,/etc/init.d/tomcat stop 也将会失效 查看Catalina.sh文件后找到以下代码,原来需要stop的话,需要CATALINA_PID文件配合。 Catalina.sh 468行 if [ ! -z “$CATALINA_PID” ]; then if [ -f “$CATALINA_PID” ]; then if [ -s “$CATALINA_PID” ]; then kill -0 `cat “$CATALINA_PID”` >/dev/null 2>&1 if [ $? -gt 0 ]; then echo “PID file found but no matching process was found. Stop …
Windows/Linux 编译和配置Tomcat Native
Tomcat Native 是利用 APR 来提升Tomcat性能的本地API。 Tomcat Native 这个项目可以让 Tomcat 使用 Apache 的 apr 包来处理包括文件和网络IO操作,以提升性能。 WIndows环境下安装Tomcat Native只需要到 http://tomcat.apache.org/download-native.cgi 下载Tomcat Native Connector的window版本,下载完毕后将 tcnative-1.dll (含32位和64位) 复制到tomcat目录下的bin目录即可使用。 Linux需要自行编译Tomcat Native Connector,具体步骤如下
CentOS7配置NFS文件共享
NFS(Network File System)即网络文件系统,是Linux/Unix支持的文件系统中的一种,它允许网络中的计算机之间通过TCP/IP网络共享资源。在NFS的应用中,本地NFS的客户端应用可以透明地读写位于远端NFS服务器上的文件,就像访问本地文件一样。 测试环境 CentOS7.3 NFS服务端配置 1.安装nfs-utils和rpcbind # yum update yum -y update # install nfs yum -y install nfs-utils rpcbind 2.启用和打开NFS相关服务rpcbind,nfs-server,nfs-lock,nfs-idmap。 注意需要先启动rpcbind #enable services systemctl enable rpcbind systemctl enable nfs-server systemctl enable nfs-lock systemctl enable nfs-idmap # start nfs service systemctl start rpcbind systemctl start nfs-server systemctl start nfs-lock systemctl start nfs-idmap