Apache Change Default User - apache

I wish to run apache under a user named app_user. To achieve this I changed the following in the httpd.conf file
User app_user
Group app_user
app_user is a valid user and a group on this server.
The app_user has correct privileges to write in /var/log/httpd directory.
Now when i start apache it gives me this error.
[app_user#localhost conf]$ service httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
(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
[FAILED]
Appreciate some help on this.

Only 'root' user can bind connections to ports lesser than 1024. For more information here. Either configure the apache to use different port number which is higher than 1024 or sudo as root user. Later option is not recommended.

Root should start apache main process to bind lower ports but, if you want to use different user/group for the sub processes you can configure through APACHE_RUN_USER and APACHE_RUN_GROUP environmental variables.
check /etc/apache2/apache2.conf:
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

Related

AH00558: httpd: Could not reliably determine the server's fully qualified domain name,Set the 'ServerName' directive globally to suppress this message

I've tried to run apache server with
sudo apachectl start
sudo apachectl stop
and I encountered these errors
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using exampleui-MacBookPro.local. Set the 'ServerName' directive globally to suppress this message
(48)Address already in use: AH00072: make_sock: could not bind to address [::]:8080
(48)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:8080
no listening sockets available, shutting down
AH00015: Unable to open logs
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using Hoonui-MacBookPro.local. Set the 'ServerName' directive globally to suppress this message
httpd (pid 6276?) not running
So I searched stackoverflow and exchanged ServerName localhost in etc/apache2/httpd.conf file to ServerName localhost:8080 and it was uncommented already.
It didn't change even after changing ServerName into
localhost
localhost:80
localhost:8080
127.0.0.1
and I also tried to kill process with kill -9 pid but nothing changed

Apache version conflict (cont)

Concerning the post Apache versions conflict. I tried again the installation of apache following the steps from https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions
I still have some problems if I want to test localhost from my local Site folder.
Result of apache log
Regarding the error
Could not reliably determine the server's fully qualified domain name,
using 127.0.0.1. Set the 'ServerName'...
I tried the option of adding ServerName localhost in the file /etc/apache2/apache2.conf https://askubuntu.com/questions/454497/apache2-could-not-reliably-determine-the-servers-fully-qualified-domain-name but I don't know if that is that is the right file, because i'm working with apache 2.4 (/usr/local/etc/apache2/2.4/httpd.conf)
Additionally, if I run the command sudo apachectl -k restart I got this
(48)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(48)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
In my file /etc/apache2/httpd.conf
I have this:
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User amhg
Group staff
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName localhost
DocumentRoot /Users/amhg/Sites
<Directory /Users/amhg/Sites>
#
AllowOverride All
and I uncommented LoadModule rewrite_module libexec/mod_rewrite.so
Any suggestions?
Thank you in advance!
you can see all of your apache installed version with command :
rpm -qa | grep httpd
in your log file I do not see any error.
can you sent all of your log file?
and can you explain what do you see in browser when go to :
http://localhost

httpd error after install for Openldap

I have made all the settings for openldap, less then httpd.
After I installed httpd, when I tried to start it with "serice httpd start",
display the following error:
[root#elara pub]# service httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
[FAILED]
I understood from net, that i need to kill a process, but I'm very confused, because I'm nubbie in Linux.
Can' someone tell me a solution for my problem?
Sounds like you installed OpenLDAP incorrectly to listen at port 80. The correct port for LDAP is 389; 636 for LDAPS.

ubuntu apache restart error

I am getting below error...
What to do?
* Restarting web server apache2 /usr/sbin/apache2ctl: 87: ulimit: error setting limit (Operation not permitted)
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
/usr/sbin/apache2ctl: 87: ulimit: error setting limit (Operation not permitted)
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
(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
Action 'start' failed.
The Apache error log may have more information.
To solve this problem You need set ServerName.
vim /etc/apache2/conf.d/name
For example set add ServerName localhost or any other name:
ServerName localhost
Restart Apache 2
service apache restart

Apache restart on Ubuntu - error "could not bind to address 0.0.0.0.80"

I'm a n00b - trying to get apache2 set up on Ubuntu 9.10 (Karmic Koala) on Rackspace Cloud. I have set up/configured OpenSSL and installed Apache, but Apache won't start. I assume its a misconfiguration in my /etc/apache2/sites-available/ssl or /etc/apache2/sites-available/default files)
When I try to restart apache using the command:
sudo /etc/init.d/apache2 restart
I get the following error message:
[error] (EAI 2)Name or service not known: Could not resolve host name *.80 -- ignoring!
[error] (EAI 2)Name or service not known: Could not resolve host name *.80 -- ignoring!
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
...fail!
For my /etc/apache2/sites-available/ssl I have used a virtual host of *:443.
For my /etc/apache2/sites-available/default i have used a virtual host of *:80
Turn off Skype. It's use port number 80 for incoming messages. Eventually check what use this port at the moment using netstat.
Second resolve is simply: Add ServerName localhost to main config. file.
Check /etc/hosts. Be sure that your machine name and localhost domain definition is correct (ie: "127.0.0.1 localhost.localdomain localhost"
However it is highly unlikely, check /etc/apache2/ports.conf if it contains explicitly "0.0.0.0"