Archive for the ‘apache’ Category
Apache could not be started because of mod_ssl
Everything was working well. But maybe a week ago, our system administrator was installing some stuff on all the machines for internal needs. After that my Apache web server hasn’t been started. Today, I needed to test something with PHP and I needed Apache for that. So, I started to investigate.
Here’s what Apache said:
Apache 2 is starting …
(OS 10048) Only one usage of each socket address (protocol/network address/port) is normally permitted. : AH00072: make_sock: could not bind to address [::]:4433.
(OS 10048) Only one usage of each socket address (protocol/network address/port) is normally permitted. : AH00072: make_sock: could not bind to address 0.0.0.0:4433.
AH00451: no listening sockets available, shutting down
AH00015: Unable to open logs
Apache could not be started
I’ve tryed to change a port number, but nothing changed. BTW, I don’t need SSL for my work, so I just tryed to comment this module in httpd.conf:
#LoadModule ssl_module modules/mod_ssl.so
After commenting mod_ssl.so Apache starts without any errors. So, it’s a workaround. But I still don’t know what’s the true problem.
How to disable directory listing
I’ve just searched for this approach but there are so many complex tips for this simple task.. So, in this article I’ll show you how to disable directory index in Apache web server.
Imagine, that you have a virtual host:
<VirtualHost *:80> ... VirtualHost> |
To disable directory listing you should add this line of code:
<VirtualHost *:80> ... Options -Indexes VirtualHost> |
It works!
By the way, I tryed to remove Options directive but the directory listing wasn’t disabled.
apr_socket_connect(): No connection could be made because the target machine actively refused it.
When the one of my local projects has been tested with an Apache HTTP server benchmarking tool (ab) I’ve got an error:
ab -c400 -n2000 http://localhost/myproject/ |
Test aborted after 10 failures.
apr_socket_connect(): No connection could be made because the target machine actively refused it. (730061)
I’ve tryed to configure httpd-mpm.conf the mpm_worker_module section but nothing changed. I’ve checked the mpm module that is using:
httpd -l
|
Compiled in modules:
…
mpm_winnt.c
…
So, my fault.. I’ve tryed to configure mpm_worker_module that isn’t used but the current mpm module that is used is mpm_winnt_module because I use XAMPP on Windows.
To fix this error you shoud set ThreadsPerChild with a bigger value and restart the web server.
Apache redirect examples using mod_alias
Hi! here I will provide few samples of how to create redirect in Apache web server. You can test this examples locally in your localhost.
First example
In the first example let’s redirect to Google search when we trying to go to localhost.
1. Go to the root folder of your web server. In my case, it’s C:\xampp\htdocs\.htaccess
and create .htaccess file if it doesn’t exist.
2. At the first line of .htaccess write:
Redirect / http://google.com
|
4. Try to go to your localhost again. Apache will redirect you to Google search.
Second example
In this example le’ts redirect to Google search only when somebody trying to go to a web server folder “my”.
1. At the first line of .htaccess write:
Redirect /my/ http://google.com
|
2. Now, when you go to your localhost you will get the right localhost page, but when you try to go to http://localhost/my/
it redirects you to Google search.
Third example
1. Let’s redirect to a subfolder when querying a subfolder. For instance, when the user entering http://localhost/my/
let’s redirect to http://localhost/site/
or when the user querying http://localhost/my/page.html
let’s redirect to http://localhost/site/page.html
2. Edit your .htaccess:
Redirect /my/ /site/
|
mod_alias
All these tricks are done with help of mod_alias so this module has to be turned on. You can read more abous this module at Apache:
Apache doesn’t start in XAMPP
I’ve already had this problem a lot of times. Apache does not start in XAMPP. I’ve had this problem in my computers and computers of my friends. As I know based on my practice, the key of this problem is in ports. Because ports that Apache uses are busy it cannot start.
By default, Apache listens a port number 80 for HTTP and a port number 443 for HTTPS.
In your system other web server may run. For example, Internet Information Services (IIS) or something else. This web server can use ports that Apache needs, I mean 80 and 443. In this way, to fix the problem you need to change the default numbers of ports of Apache or numbers of ports of the other web server that runs on your system. To change this values find Listen command in these files and change the value:
- C:\xampp\apache\conf\httpd.conf
- C:\xampp\apache\conf\extra\httpd-ssl.conf
If you have Skype it also uses these ports. In this way, to fix the problem you should uncheck the usage of these ports in Skype settings or change the numbers of ports using the method above.