Find out which process is already litening at port 80. You seem to have a pretty mess there.
As root:
netstat -tlp | grep http
Find out which process is already litening at port 80. You seem to have a pretty mess there.
As root:
netstat -tlp | grep http
Alternatively, using a similar iproute2 command…
ss -tlp | grep http
Might be better. I am still not used to these new set of commands. ![]()
The netstat command was not found. But here’s from the other one:
ss -tlp | grep http
LISTEN 0 128 127.0.0.1:http 0.0.0.0:* users:(("httpd-worker",pid=10801,fd=3),("httpd-worker",pid=10800,fd=3),("httpd-worker",pid=10799,fd=3),("httpd-worker",pid=10798,fd=3),("httpd-worker",pid=10793,fd=3))
Does it tell you anything about server speed?
You tried to let a program bind to port 80 for listening. You then got the message
“unable to bind listening socket for address ‘127.0.0.1:80’: Address already in use”
which clearly means that there is already another program listening on port 80.
You seemed to be confused that that was the case and seemed not to know how to find out which program that was.
We gave you the command to find out which program is listening on posrt 80.
Now you know and you can decide if that program should listen on port 80 or not (it is your system).
In any case there can only be one program listening on a port at the time.
Yep, that is a problem. @OP are you running any docker containers that use port 80 ?
All in vain. I’ve spent a week trying all sorts of things from all Internet - the web server is still d*mn slow. I’m pretty sure now it may not even be Apache itself but the system. Waiting for 5 sec for a page to load is nonsense, especially on my hardware.
Any suggestions what to check for in Linux?
Check page loading performance with preferred browser. There are many browser tools for this type of analysis. For example…
https://developer.mozilla.org/en-US/docs/Tools/Network_Monitor/Performance_Analysis
Thank you for the tip.
I got:
Cached responses: 0
Total requests: 42
Size: 1,527.06 KB
Transferred Size: 1,532.13 KB
Time: 5.24 seconds
Non blocking time: 5.24 seconds
JS and CSS take over 30% each. Images take 3 times less that these.
See > 5 sec to load 1.5MB from localhost. This is terrible.
I see there it’s using HTTP v1.1 but I’ve installed and enabled v2
Well, apparently my server fails at https. Again I followed how to set up SSL what I could find on the Internet. Unfortunately they’re all for Ubuntu, CentOS, windows, anything but openSUSE.
It should work but it doesn’t, probably because of different config naming conventions. I’ve followed this one: https://help.ubuntu.ru/wiki/apache_и_https
What I have is:
/etc/apache2/httpd.conf
ServerName localhost
/etc/apache2/listen.conf
Listen 443
/etc/apache2/vhosts.d/ssl.conf
<VirtualHost *:443>
DocumentRoot "/srv/www/htdocs"
SSLEngine on
SSLCertificateFile /etc/ssl/certs/server.pem
SSLCertificateKeyFile /etc/ssl/private/server.key
<Directory "/srv/www/htdocs">
DirectoryIndex index.html index.php
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
127.0.0.1 localhost
# special IPv6 addresses
::1 localhost ipv6-localhost ipv6-loopback
fe00::0 ipv6-localnet
ff00::0 ipv6-mcastprefix
ff02::1 ipv6-allnodes
ff02::2 ipv6-allrouters
ff02::3 ipv6-allhosts
I restart Apache and it fails with:
Address already in use: AH00072: make_sock: could not bind to address ::]:443
Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:443
I searched on internet, they all say Listen 443 appears twice somewhere. But I’ve checked by word search, listen.conf is the only place!
What would you suggest?
Ok, I got it!
Changing ‘Listen 443’ to ‘Listen 443 https’ in listen.conf and adding ‘Redirect /localhost https://localhost/’ to httpd.conf have fixed it. Not I have a working https. BUT!..
Looking at the Web Developer Tools, it still shows
Request URL:https://localhost/c585/concrete/js/picturefill.js?ccm_nocache=d846f33d9148b37e63b22ff9a7339155be77a7f9
Request method:GET
Remote address:127.0.0.1:443
Status code:200
Version:**HTTP/1.1**
Referrer Policy:no-referrer-when-downgrade
Why is it still using HTTPv1 and not v2?
AND it’s still d*mn sloooooooooooooooooooooooooow
Shouldn’t that be
Listen 0.0.0.0:443
Somewhere I have a memory that I have changed from 80 to 0.0.00:80 not long ago because of some change in how it works.
Mine is at the moment (but I use only http):
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports. See also the <VirtualHost> directive.
#
# http://httpd.apache.org/docs/2.4/mod/mpm_common.html#listen
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
# When we also provide SSL we have to listen to the
# standard HTTP port (see above) and to the HTTPS port
#
# Note: Configurations that use IPv6 but not IPv4-mapped addresses need two
# Listen directives: "Listen ::]:443" and "Listen 0.0.0.0:443"
#
#Listen 12.34.56.78:80
#Listen 80
#Listen 443
Listen 0.0.0.0:80
<IfDefine SSL>
<IfDefine !NOSSL>
<IfModule mod_ssl.c>
# Listen 443
</IfModule>
</IfDefine>
</IfDefine>
This finally works:
<VirtualHost *:443>
DocumentRoot "/srv/www/htdocs"
ServerName localhost:443
Protocols h2 h2c http/1.1
SSLEngine on
SSLProtocol all -SSLv2
SSLCertificateFile /etc/ssl/certs/server.pem
SSLCertificateKeyFile /etc/ssl/private/server.key
<Directory "/srv/www/htdocs">
DirectoryIndex index.html index.php
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
The last but the most important bit left is to speed it up!
Should I install any caching packages?
I remember I’ve installed npm, vue.js, node.js and a lot of other Laravel stuff some weeks ago. Can it be that they’re running at the background and they’re slowing the server? As I said at the beginning, Apache slowed down after I played around with Laravel and VirtualBox/Vagrant. It was relatively fast before that.
I think I’m back in business!
I’ve installed these 3 packages: php7-APCu, php7-memcached, php7-opcache and the load time has just HALVED! Excellent. Phew… 2 weeks of pain in the *** and I think I’m where I’ve been )))
I think what happened was, when played around with all that Laravel stuff installing and reinstalling and deleting stuff, I’ve accidentally clicked the YAST’s Cleanup When Deleting Packages option and it deleted some stuff, then I tougtht it was Apache, then something else, then I reinstalled Apache, then changed php to php-fpm…
But now I know how to set up Apache+PHP-fpm+MySql+SSL+mod_rewrite on localhost!
Linux rocks!.. Although when it stops rocking it’s such a pain in *** )))))
You are installing on openSUSE Leap. Consult the documentation: https://doc.opensuse.org/documentation/leap/reference/html/book.opensuse.reference/cha-apache2.html#sec-apache2-ssl ![]()
What is your memory:
erlangen:~ # inxi -zmxx
Memory: RAM: total: 15.30 GiB used: 2.22 GiB (14.5%)
Array-1: capacity: 32 GiB slots: 4 EC: None max module size: 8 GiB note: est.
Device-1: ChannelA-DIMM0 size: 8 GiB speed: 1600 MT/s type: DDR3 manufacturer: 1314 part-no: 992099 (997099)
Device-2: ChannelA-DIMM1 size: No Module Installed
Device-3: ChannelB-DIMM0 size: No Module Installed
Device-4: ChannelB-DIMM1 size: 8 GiB speed: 1600 MT/s type: DDR3 manufacturer: 1314 part-no: 992099 (997099)
erlangen:~ #
I’ve got 16GB
(I don’t have that command)
Now I get another problem. My web applications fail during installation with error:
Gateway Timeout The gateway did not receive a timely response from the upstream server or application.
I read it may be something to do with the PHP default_socket_timeout = 60. I changed it to 600 in /etc/php7/cli/php.ini but visiting localhost with phpinfo() it still shows value of 60. Is this the right php.ini on openSUSE?
cli is used for CLI applications only, apache2 for apache2 and php-fpm for NGINX or certain other web servers.
So edit /etc/php7/apache2/php.ini and restart Apache2.
There is no such folder as /etc/php7/apache2. I’ve just created a new php.ini in /etc/php7/fpm/ and it seems to work. At least phpinfo() shows the new value
Well, I have to admit whatever I’ve done was a total waste of time and effort.
I started having weird issued during CMS plugin installations with the server timeouts and code exceptions I’ve never had before with the same untouched code. Something was really wrong with the server settings.
So I’ve just uninstalled ALL Apache and PHP packages, rebooted, installed only the previous Apache-prefork and mod_php, no SSL, rebooted and it FLIES! The page load time is now 0.9 s!!! That’s what I’m talking about.
So the morale is if you don’t know what you’re doing, don’t do it and stick with what works… after reinstall.
If you had to edit php-fpm to make any changes to PHP functionality in Apache, you were using apache2 with it, which for most average scenarios is completely wrong.
The default out of the box SUSE wouldn’t even do that (it would use apache2-mod_php7) so you must’ve followed some online tutorial which was all wrong.