I have a Centos Stream 9 server running Apache 2. I think it is mostly well configured since I never get error messages in my CLI when doing the sudo systemctl restart httpd.service command. But I'm getting a 503 error message trying to access my server with the IP or the domain name in a browser.
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>503 Service Unavailable</title>
</head><body>
<h1>Service Unavailable</h1>
<p>The server is temporarily unable to service your
request due to maintenance downtime or capacity
problems. Please try again later.</p>
</body></html>
The thing is I have Laravel installed there and I usually run composer to do the updates and I also pull from git. Those commands are ran by my default user centos:centos, while my web server is ran by apache:apache. I wanted to switch my webserver to the same user because I was getting write permission errors when doing the composer install command. The /storage and /bootstrap directories were owned by the apache user.
So, I still don't know if this is something that has to do with my Laravel install, or the server configuration. I was thinking it was a firewall thing, but I'm guessing there must be a way to run my httpd service with my centos user to fix this issue.
Looking into the Error log I found that it was actually getting a message about FastCGI.
(13)Permission denied: AH02454: FCGI: attempt to connect to Unix domain socket /run/php-fpm/www.sock (*) failed
Doing some research into the error I understood that it had to do with the configuration of php-fpm
The following is a link to a post that contains good information to solve the problem althought the approved answer is not the correct answer for the problem and I had to dig a little bit into configuring the php-fpm module:
FPM with apache2 not working (Permission denied)
Lastly, I will share a link to the PHP-FPM installation instructions that also gave me an idea on how to fix it, but not exactly worked for my problem:
Configure Apache with PHP-FPM
If possible to you change current configuration?
if yes...
PHP-FPM is able to work using socket file or tcp socket, so you can:
1.Change to TCP configuration (/etc/php-fpm.d/www.conf by default)
listen = 127.0.0.1:9000
listen.allowed_clients = 127.0.0.1
2.Change your apache configuration
From:
SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost"
To:
SetHandler "proxy:fcgi://127.0.0.1:9000"
3.Restart both services.
Related
I'm having trouble connecting to a replica set.
[MongoDB\Driver\Exception\ConnectionTimeoutException]
No suitable servers found (`serverSelectionTryOnce` set):
[Server closed connection. calling ismaster on 'a.mongodb.net:27017']
[Server closed connection. calling ismaster on 'b.mongodb.net:27017']
[Server closed connection. calling ismaster on 'c.mongodb.net:27017']
I however, can connect using MongoChef
Switching any localhost references to 127.0.0.1 helped me. There is a difference between localhost and 127.0.0.1
See: localhost vs. 127.0.0.1
MongoDB can be set to run on a UNIX socket or TCP/IP
If all else fails, what I've found that works most consistently across all situations is the following:
In your hosts file, make sure you have a name assigned to the IP address you want to use (other than 127.0.0.1).
192.168.0.101 coolname
or
192.168.0.101 coolname.somedomain.com
In mongodb.conf:
bind_ip = 192.168.0.101
Restart Mongo
NOTE1: When accessing mongo from the command line, you now have to specify the host.
mongo --host=coolname
NOTE2: You'll also have to change any references to either localhost or 127.0.0.1 to your new name.
$client = new MongoDB\Client("mongodb://coolname:27017");
I had the same error in a docker based setup:
container1: nginx listening on port 80
container2: php-fpm listening on port 9000
container3: mongodb listening on port 27017
nginx forwarding php to php-fpm
Trying to access mongodb from php gave this error.
In the mongodb Dockerfile, the culprit was:
CMD ["mongod", "--bind_ip", "127.0.0.1"]
Needed to change it to:
CMD ["mongod", "--bind_ip", "0.0.0.0"]
And the error went away. Hope this helps somebody.
The IP address of your home network may have changed, which would lead to MongoDB locking you out.
I solved this problem for myself by going to MongoDB Atlas and changing which IP address is allowed to connect to my data. Originally, I'd set it up to only allow connections from my home network. But my home network IP address changed, and I started getting the same error message as you.
To check if this is the same issue with you, go to MongoDB Atlas, go into your project, and click "Network Access" on the left hand side of the screen. That's where you're able to update your IP address. It shows you what IP address(es) it's allowing in. To find out what your current IP address is, go to whatismyipaddress.com and update MongoDB if it's different.
In my case, I am temporarily coding PHP from Windows7 against MongoDB on my VPS running Linux Debian 9. The PHP will be eventually running in the same Linux box to provide an API to the MongoDB data.
BTW, it does not appear this local composer install is doing me any good, it's pure ugliness. My PHP after the fix below works without the require line require_once 'C:\Users\<Windows User Name>\vendor\autoload.php'.
My fix is different than the accepted answer which to me did not make sense.
I did not have to touch any hosts file
So edit your /etc/mongod.conf with your target machine's IP and restart with sudo systemctl restart mongod that's it
I don't know what to blame
PHP and MongoDB sites for the terrible documentation skimpy and incomplete PHP examples, or...
MongoDB installation on Linux failing to mention this bindIP.
My startup experience with MongoDB is so far very negative given all the changes that have occurred nothing matches what I expected from the videos I watched. I can't seem to find any that reflect what I am going thru like
$DB_CONNECTION_STRING="mongodb://user:password#164.152.09.84:27017"
$m = new MongoDB\Driver\Manager( $DB_CONNECTION_STRING )
instead of
$m = new MongoClient()
Hope this helps someone
PS. Always say NO to semicolons, camelCAsE and anything case-sensitive... absurdity at its best.
Installed Webmin successfully on a Debian system.
Created a virtual server, added some users and a domain.
Installed ProFTPD via Webmin's unused modules.
Added a new user with same named group via System -> Users and Groups.
Tried to connect via ftp using my server's external ip and my new user's credentials.
This should work according to most tutorials but it doesn't.
I'm suspecting some other service handles FTP requests before ProFTPD.
Is there a way to monitor protocol handlers? Could it be something else?
Thanks in advance.
because webmin try start it as deamon, but maybe (like me on archlinux) you need to start it as system service... on root:
systemctl start proftpd.service
If you want to look at the logs error (if there is errors, but if server is not start, it should ne have error...) then use:
journalctl -xe command (as root), or
systemctl --failed , or
systemctl status proftpd.service (all of these commands under root user or sudoers users).
So first of all, check that service is running:
systemctl status
then check the config file of webmin service for proftpd use the correct protocol for call service (systemd for example), and then use correct sentence code for start/stop it. Check also it goes to look at the correct config file of proftpd current install place (depend of your distribution or the way you install it).
proftpd is not installed by webmin, proftpd is installed, then from webmin, you install a module who has to communicate with allready installed application proftpd. If this module is well configured for point on actual proftpd installation and correct call of service, then all will have to works.
(please, if this answer help you, do up vote for my answer, without notation when i help, i can not help more because i'm locked by the system, hope you understand)
Have a look at the server's log, check le ProFTP daemon status, check the firewall
I got an minor Problem with Gitlab.
I setup the complete system according to the manual from gitlab.
I used an nginx xserver with theire nginx config file.
If I access any none php file it works.
But as soon as I open one of these files I get ofllowing line in the server log:
2013/12/04 14:24:46 [error] 28622#0: *10 access forbidden by rule, client: aaa.bbb.ccc.ddd, server: xxx.xxxx.xxx, request: "GET /dev/worker/blob/master/call.php HTTP/1.1", host: "xxx.xxxx.xxx", referrer: "https://xxx.xxxx.xxx/dev/worker/tree/master"
I'm accessing the server over https.
Internaly it runs on http
I also have installed php-fpm but it does not run on the current host.
Please help
Chris
The Problem was the nginx configuration itself.
I have an ispconfig panel running that creates the nginx site files.
Problem was, it creates an entry that disallows php files to everyone.
It makes sence for php based sites, as the php files can only be accessed through the fpm process.
But it makes no sence for a git server
^^
thanks for the patience
Just got XAMPP 1.8.1 installed on my Windows 8 PC, this version includes packages mentioned below:
Apache 2.4.3
MySQL 5.5.27
PHP 5.4.7
phpMyAdmin 3.5.2.2
FileZilla FTP Server 0.9.41
Tomcat 7.0.30 (with mod_proxy_ajp as connector)
Strawberry Perl 5.16.1.1 Portable
XAMPP Control Panel 3.1.0 (from hackattack142)
When I launched and tried to start Apache, it gave following error:
12:04:41 PM [Apache] Attempting to start Apache app...
12:04:41 PM [Apache] Status change detected: running
12:04:42 PM [Apache] Status change detected: stopped
12:04:42 PM [Apache] Error: Apache shutdown unexpectedly.
12:04:42 PM [Apache] This may be due to a blocked port, missing dependencies,
12:04:42 PM [Apache] improper privileges, a crash, or a shutdown by another method.
12:04:42 PM [Apache] Check the "/xampp/apache/logs/error.log" file
12:04:42 PM [Apache] and the Windows Event Viewer for more clues
After that I checked error.log, it was empty so no help from there.
So here is the solution for this:
I check port 80 used by Skype, after that I changes port to 81 and also along with that somewhere i read this error may be because of SSL Port then I changed SSL port to 444. However this got resolved easily.
One most important thing to notice here, all the port changes should be done inside config files, for http port change: httpd.conf for SSL httpd-ssl.conf. Otherwise changes will not replicate to Apache, Sometime PC reboot is also required.
Edit: Make Apache use port 80 and make Skype communicate on other Port
For those who are struggling with Skype, want to change its port and to make Apache to use port 80.
No need to Re-Install, Here is simply how to change Skype Port
Goto: Tools > Options > Advanced > Connection
There you need to uncheck Use port 80 and 443 as alternative for incoming connections.
That's it, here is screen shot of it.
I had the exact same error.
It was because i didn't run setup_xampp.bat
This is a better solution than going through config files and changing ports.
This problem may occur due to apache not getting required port (default is 80).
The port may be being used by other services.
For example: Skype also has default port 80.
Installing Skype and Apache both on same machine will cause conflict and hence Apache will not start.
Either, you change Skype port or change Apache port as described in following steps:
Change the ports of Apache and it will work for you.
Go to httpd.conf
How to change port for Apache:
Search for:
ServerName localhost:80
Change it to:
ServerName localhost:81
Also Search For:
Listen 80
Change it to:
Listen 81
If you have created any virtual hosts, change the ports there also.
Then restart your apache.
I had the same problem, but I understand the VMware service is the problem. VMware host service and Apache service conflict together.
To Solve it »
Run your task manager » in services tab find VMwareHostd » then right click and stop it » every thing have been solved.
Enter services.msc and shutdown anything SQL you have running.
The SQL server might be taking over the port.
I had the same problem and error, I tried changing the ports for http port from 80 to 81 and ssl port from 443 to 444 but still received the same error so I reverted the ports to default and ran setup_xampp.bat which solve the problem in seconds.
Skype is usually the culprit because it uses port 80 by default. Just close it or uncheck "Use port 80 and 443 as alternatives for incoming connections" under tools > options... > advanced > connection and then restart Skype.
I had to manually edit the 2 text files (httpd.conf and httpd-ssl.conf) using the Config button for Apache to run and change in notepad from 80 > 81 and 443 > 444
Using the Xampp UI config manager doesn't save the changes into Apache.
change 80 to 81 and 443 to 444 by clicking config button and editing httpd.conf and httpd-ssl.congf. Now you can Access XAMPP from 127.0.0.1:81
An error in your httpd.conf or other Apache config files will cause this. Revert httpd.conf et al to the pristine, installer versions and see if Apache runs again.
(I tried Skype and other suggestions here, no luck, but logs [XAMPP > Apache > Logs button] showed that it ran once when first installed. That was the giveaway.)
Likely errors:
Did you edit with a Windows text editor that changes line endings to non-Unix? (Solution here.)
Missing or invalid DSO files (.so)
I had this problem and then I ran "apache_start.bat" the error in german told me there was a problem with line 51 in httpd-ssl.conf which is
SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
What I did was comment lines 163 (ssl module) and 522 (httpd-ssl.conf include) in httpd.conf;
I don't need ssl for development, so that solved it for me.
I recently installed Apache 2.4.1 on my mac(10.7) and executed "httpd". I received these two error messages when websharing was turned off in system preferences:
//(1)-In the console//
httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.1.65 for ServerName
(48)Address already in use: make_sock: could not bind to address [::]:80
(48)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
//(2)-In the browser//
Not Found
The requested URL / was not found on this server.
Apache/2.2.20 (Unix) DAV/2 PHP/5.3.6 with Suhosin-Patch Server at 0.0.0.0 Port 80
// 2nd Test for Clarification
Quick experiment: Websharing turned on.
I switched to the 2.4.1 folder and ran "apachectl start". Here is the code:
usr/local/apache2/bin] root# apachectl start
org.apache.httpd: Already loaded
I checked 0.0.0.0 on chrome
The message, "It works", popped up. No sign of the apache 2.2.2 404 error message seen when websharing was off.
I typed in terminal "apachectl stop"
I checked 0.0.0.0 again and received the message "Oops! Google Chrome could not connect to 0.0.0.0."
//Added clarification 3/25/12
This mac already came pre-installed with apache 2.2.2. Does the presence of it (It is not running. I had the websharing option turned off.) on my hard drive interfere with the recent installation of apache 2.4.1?
When I turn websharing on, I do not get the apache 2.2.2 404 error message but the index.html page at 0.0.0.0:80. I don't understand why apache 2.4.1 will not run even when the websharing option is turned off. I think when I execute "apachectl start" in "usr/local/apache2/bin/" the computer activates apache 2.2.2 instead of 2.4.1. Why?
Could anyone add some clarity to this problem? I want to use apache 2.4.1 instead of being forced to use apache 2.2.2. Thanks!