普通用户启动apache服务

##创建普通用户,并切换到普通用户下

useradd lvnian002

tail -5 /etc/passwd

echo asdasd | passwd --stdin lvnian002

su lvnian002

##########

[[email protected] conf]# useradd lvnian002

tail -5 /etc/passwd

echo asdasd | passwd --stdin lvnian002

su lvnian002[[email protected] conf]# tail -5 /etc/passwd

tcpdump:x:72:72::/:/sbin/nologin

mysql:x:500:500::/home/mysql:/sbin/nologin

lvnian:x:501:501::/home/lvnian:/sbin/nologin

apache:x:502:502::/home/apache:/sbin/nologin

lvnian002:x:503:503::/home/lvnian002:/bin/bash

[[email protected] conf]# echo asdasd | passwd --stdin lvnian002

Changing password for user lvnian002.

passwd: all authentication tokens updated successfully.

[[email protected] conf]# su lvnian002

[[email protected] conf]$

###创建apache服务目录,并创建相关目录,已经配置文件

mkdir -p /home/lvnian002/application/apache

cp /application/apache/conf /home/lvnian002/application/apache/ -ap

cp /application/apache/logs /home/lvnian002/application/apache/  -ap

cp /application/apache/htdocs /home/lvnian002/application/apache/  -ap

cp /application/apache/error /home/lvnian002/application/apache/  -ap

[[email protected] conf]$ mkdir -p /home/lvnian002/application/apache

[[email protected] conf]$ cp /application/apache/conf /home/lvnian002/application/apache/ -ap

[[email protected] conf]$ cp /application/apache/logs /home/lvnian002/application/apache/  -ap

[[email protected] conf]$ cp /application/apache/htdocs /home/lvnian002/application/apache/  -ap

[[email protected] conf]$ cp /application/apache/error /home/lvnian002/application/apache/  -ap

[[email protected] conf]$

###修改普通用户的apache服务端口号,防止和其他apache服务端口号一样

cd /home/lvnian002/application/apache/conf/

#less apache.conf

grep -i listen httpd.conf

sed -i ‘s/listen       80/listen       8080/g‘ apache.conf

grep -i listen httpd.conf

#######

[[email protected] conf]$ grep -i listen httpd.conf

# Listen: Allows you to bind Apache to specific IP addresses and/or

# Change this to Listen on specific IP addresses as shown below to

#Listen 12.34.56.78:80

Listen 80

[[email protected] conf]$

[[email protected] conf]$ sed -i ‘s/Listen 80/Listen 8080/g‘ httpd.conf

[[email protected] conf]$ grep -i listen httpd.conf

# Listen: Allows you to bind Apache to specific IP addresses and/or

# Change this to Listen on specific IP addresses as shown below to

#Listen 12.34.56.78:80

Listen 8080

[[email protected] conf]$

######启动apahce服务,并检查是不是普通用户启动的

/application/apache/bin/httpd -f /home/lvnian002/application/apache/conf/httpd.conf -k start

netstat -lnt

ps -ef |grep httpd

########3

[[email protected] conf]$ /application/apache/bin/httpd -f /home/lvnian002/application/apache/conf/httpd.conf -k start

[[email protected] conf]$ netstat -lnt

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address               Foreign Address             State

tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN

tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN

tcp        0      0 :::8080                     :::*                        LISTEN

tcp        0      0 :::22                       :::*                        LISTEN

tcp        0      0 ::1:25                      :::*                        LISTEN

[[email protected] conf]$

[[email protected] conf]$ ps -ef |grep httpd

503      43857     1  0 13:18 ?        00:00:00 /application/apache/bin/httpd -f /home/lvnian002/application/apache/conf/httpd.conf -k start

503      43858 43857  0 13:18 ?        00:00:00 /application/apache/bin/httpd -f /home/lvnian002/application/apache/conf/httpd.conf -k start

503      43859 43857  0 13:18 ?        00:00:00 /application/apache/bin/httpd -f /home/lvnian002/application/apache/conf/httpd.conf -k start

503      43860 43857  0 13:18 ?        00:00:00 /application/apache/bin/httpd -f /home/lvnian002/application/apache/conf/httpd.conf -k start

503      43861 43857  0 13:18 ?        00:00:00 /application/apache/bin/httpd -f /home/lvnian002/application/apache/conf/httpd.conf -k start

503      43963 43763  0 13:23 pts/1    00:00:00 grep httpd

[[email protected] conf]$

故障解决:

[[email protected] conf]$ /application/apache/bin/httpd -f /home/lvnian002/application/apache/conf/httpd.conf -k start

(13)Permission denied: httpd: could not open error log file /application/apache2.22.27/logs/error_log.

Unable to open logs

[[email protected] conf]$

切换到root用户下,给logs文件授权

[[email protected] apache]# chmod  777 /application/apache2.22.27/logs -R

[[email protected] apache]#

时间: 2024-10-26 07:57:28

普通用户启动apache服务的相关文章

windows下以普通用户权限启动apache服务

在windows下安装apache,默认情况下,apache以本地系统权限启动服务,权限过高,存在安全隐患.以普通用户权限启动apache服务的步骤如下: 添加一个普通用户apache_user 打开服务管理器,在apache服务的属性页的登录选项卡下,选中"此用户",然后输入apache_user及其密码 修改apache安装目录下logs目录的权限,使apache_user对其有完全控制权限 重启apache服务(如果失败,请重启操作系统) 原文地址:http://blog.51c

xammp start apache service FQA(xammp启动apache服务问题解决方案汇总)

xammp=apache+php+mysql  相当于一个服务集成包吧,主要是帮助用户免去配置的烦恼. 问题描述: 但是xammp也会出问题,通常是启动不了apache服务,一般会显示如下错误信息: 9:20:15 [Apache] Status change detected: stopped <span style="color:#ff0000;">9:20:15 [Apache] Error: Apache shutdown unexpectedly. 9:20:15

启动apache服务出现Job failed. See system logs and &#39;systemctl status&#39; for details. .

启动apache服务出现Job failed. See system logs and 'systemctl status' for details. 查看错误提示 看日志 cat /var/log/messages | grep httpd 原来是编辑httpd.conf文件时候第196行出错 vi /etc/httpd/conf/httpd.conf systemctl start httpd.service 解决 启动apache服务出现Job failed. See system log

普通用户启动nginx服务

普通用户下启动nginx服务 创建普通用户 useradd lvnian010101 tail -5 /etc/passwd echo asdasd | passwd --stdin lvnian010101 ############## [[email protected] home]# useradd lvnian010101 [[email protected] home]# tail -5 /etc/passwd deng:x:500:500::/home/deng:/bin/bash

配置PHP启动Apache服务报错

在新的服务器(centos 6.3)编译安装完php-5.4.8,再配置好php.ini和httpd.conf后,启动apache-2.4.3的时候,命令执行/usr/local/apache2/bin/apachectl start时,提示: httpd: Syntax error on line 146 of /etc/httpd/conf/httpd.conf: Cannot load /usr/local/apache/modules/libphp5.so into server: /u

《Apache服务用户身份验证管理》RHEL6.3

1.安装apache软件包 Yum install httpd 2.启动apache服务 /etc/init.d/httpd restart 3.创建一个目录,内编辑一个index.html文件 4.给这个目录设密码(是不是很passwd文件内用户的密码文件很像) 5.编辑apache配置文件/etc/httpd/conf/httpd.conf文件(添加如下行) 6.重启apache服务 7.验证是否配置成功 8.结果 <Apache服务用户身份验证管理>RHEL6.3,码迷,mamicode

C#判断程序是由Windows服务启动还是用户启动

在Windows系统做网络开发,很多时候都是使用Windows服务的模式,但在调度阶段,我们更多的是使用控制台的模式.在开发程序的时候,我们在Program的Main入口进行判断.最初开始使用Environment.UserInteractive属性,在系统不系统服务的交互模式时,程序运行是正常的,但试过有Win7下,系统允许交互模式,结果在服务启动的时候,跳转到控制台的模式了,服务启动不起来.只能在服务的调用方式下带参数,然后在Main的参数中判断是否为服务方式.这在一般的情况下是可以解决问题

Ubuntu启动/重启/停止apache服务

Start Apache 2 Server /启动apache服务 # /etc/init.d/apache2 start or $ sudo /etc/init.d/apache2 start Restart Apache 2 Server /重启apache服务 # /etc/init.d/apache2 restart or $ sudo /etc/init.d/apache2 restart Stop Apache 2 Server /停止apache服务 # /etc/init.d/a

Android开发--Apache服务器安装,解决Apache服务无法启动的问题

昨天学习Android XML解析的时候,想在自己的电脑上搭建一个最简单的Web服务器来存放一段XML文本,然后在Android程序中解析,查找了一些资料后,看到Apache服务器比较容易上手,使用范围也比较广泛,于是就决定使用它了. 1.下载Apache服务器安装包,地址:http://httpd.apache.org/download.cgi 我选择了2.4.12这个版本,在Apache官网找了半天以为会有.msi的安装包,但是却一直没找到,好吧没有就没有了(想偷懒却没有提供一键安装包,唉)