Localhost very slow on Windows 7 (tried other suggestions..nothing worked) - apache2

I know this has been asked before but I have tried every suggestion i've found but nothing seems to work
My localhost seems to take forever to load pages (up to 30 secs). Ihave the follwoing installed on Windows 7
I am running:
Apache 2.4
PHP 5.4.9
MySQL 5.5.25
Things I have tried:
Edited the hosts file in Windows\System32\drivers\etc
# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
Edit the http.conf file to give a ServerName
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName 127.0.0.1:80
Has anyone got any other suggestions?

Related

Virtual Host in WSL2 not accessible from windows browser

I had setup a virtual host for the osm tile server. All the tables are made and style sheet is generated using mapnik using this tutorial:https://www.linuxbabe.com/ubuntu/openstreetmap-tile-server-ubuntu-20-04-osm
The only process I changed here is using service instead of systemctl as the latter is not supported. I have named the vhost as tile.gearmap.com in the config files. These are the files: -
/etc/apache2/sites-available/tileserver_site.conf
<VirtualHost *:80>
ServerName tile.gearmap.com
LogLevel info
Include /etc/apache2/conf-available/renderd.conf
</VirtualHost>
/etc/renderd.conf
[renderd]
stats_file=/run/renderd/renderd.stats
socketname=/run/renderd/renderd.sock
num_threads=10
tile_dir=/var/cache/renderd/tiles
[mapnik]
plugins_dir=/usr/lib/mapnik/3.1/input
font_dir=/usr/share/fonts/truetype
font_dir_recurse=true
; ADD YOUR LAYERS:
[default]
URI=/osm/
XML=/home/osm/openstreetmap-carto/style.xml
HOST=tile.gearmap.com
https://www.linuxbabe.com/ubuntu/openstreetmap-tile-server-ubuntu-20-04-osm
[Service]
User=osm
Result of Apache2 server status
I also added the third line to hosts hoping it would work:
However, when I open http://tile.gearmap.com/osm/0/0/0.png in my chrome, it shows 404 error instead of the map tile. This is all done in wsl ubuntu 20.04 and browser is in windows. Please help me find the error. If any additional files are needed to debug this, let me know.
Check if the traffic is exposed over tcp4 or tcp6 (try netstat within Ubuntu), there is a longstanding issue of WSL2 not supporting ipv6: https://github.com/microsoft/WSL/issues/4518

Failed to load resource: net::ERR_CONNECTION_TIMED_OUT on remote but works fine on localhost

i have react with asp.net core website . it worked fine on localhost but when published on iis remote server the timeout error occurs.
the front-end (react client) and back-end(server) asp.netcore webapi work independently.
before uploading i changed the following in program.cs in webapi.
usUrl("https://localhost:4000")
to useUrl("https://www.virtualcollege.pk:4000")
i also changed the front-end baseurl similarly.
moreover, the connectionstrings in appsettings.json is correct for both databases.
i added migration and updated the databases successfully.
the website is live but timeout error occur :
virtualcollege.pk
i also tried the url with "https://myip-address:4000"
thanks in advance for help.
if i remove port number from url and publish on local folder than upload to remote server . the webapi.exe on local machine runs as follows:
You have to open incoming request for 4000 port. Try some methods below.
Windows Server
Please check this link or this one
Ubuntu/Debian
sudo ufw allow 4000/tcp
sudo ufw status // check status
CentOS
First, you should disable selinux, edit file /etc/sysconfig/selinux so it looks like this:
SELINUX=disabled
SELINUXTYPE=targeted
Save file and restart system.
Then you can add the new rule to iptables:
iptables -A INPUT -m state --state NEW -p tcp --dport 4000 -j ACCEPT
and restart iptables with /etc/init.d/iptables restart

Accessing nagios 3 web interface with a Domain name

I am accessing nagios web interface with an ip x.x.x.x/nagios3 but instead I want to access it with a domain name nagios.xyz.com locally first. How can this be done? I have installed nagios 3 apache 2 on ubuntu 16.04 .
IF your Ubuntu have static IP, you can edit your local /etc/hosts file and insert this line (I suppose you are using Linux):
x.x.x.x nagios.xyz.com
Now you can open nagios.xyz.com/nagios3 with your browser and get your Nagios web interface.
PS: Anyway, this solution will work only from your PC/NTB.

Apache 2 running even when stopped

I am using Ubuntu 14.04 on my VPS, and I'm trying to run Apache Tomcat on port 80.
So, I changed the Apache2 ports.conf (and the default.conf in sites-enabled) to a different port, and server.xml for tomcat to point to port 80.
However, many a times, I get the default Apache2 page on port 80 (even after disabling the default site and even deleting index.html from /var/www/html). Refreshing a few times helped earlier, but starting today, that didn't help. So, I stopped the Apache2 service and yet, it still shows up.
Tomcat is showing up when trying to access the site with the IP address or with http://www.nurvsofsteel.com, but not with the domain name: http://nurvsofsteel.com
Please help...
I had a similar problem and found that it was actually Nginx that was running on port 80 and picking up the Apache default page! This post helped figure it out.
In your case, it might actually be Tomcat running on port 80 but just showing a different default page. Try running sudo netstat -l4np to check which process is listening at port 80
I was able to find the problem. I had accidentally edited the /etc/hosts in my local machine instead of on the VPS (both the usernames were same, and I'd forgotten that I was logged in to the VPS from another tab in my terminal).

MacPorts Apache2 Stopped Launching on Boot

Something that I've noticed recently on two different machines is that Apache2 installed via MacPorts seems to have stopped launching when I boot up. The honest truth is that I can't swear it did so before, but it's something I think I'd notice because installing the LaunchDaemon is part of my install process. In fact, if I try to reload the LaunchDaemon, it fails:
$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist
org.macports.apache2: Already loaded
Unless I start Apache manually (using sudo apachectl restart), grep'ing for either "apache2" or "httpd" in my process list only produces this:
$ sudo ps -ef | egrep "apache2|httpd"
0 52 1 0 0:00.06 ?? 0:00.08 /opt/local/bin/daemondo --label=apache2 --start-cmd /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start ; --stop-cmd /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper stop ; --restart-cmd /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper restart ; --pid=none
1410639199 6960 6792 0 0:00.00 ttys001 0:00.00 egrep apache2|httpd
Looks like the daemon itself is in place, but no executable. As far as I know/can tell, the relevant executables (httpd and apachectl) are executable by everyone.
Has anyone else noticed this? Any ideas?
UPDATE
As requested below, I did execute launchctl list. The list is long and I'm not sure how to snip it, but suffice to say that no org.macports.* items are listed. That in itself is interesting because my MySQL daemon is loaded the same way. It works, but also doesn't appear in the list. Let me know if the entire output is really needed.
UPDATE
I assumed that I had executed launchctl list under sudo, but prompted by mipadi's comment below, I tried again ensuring that I did so and I assumed incorrectly. When executed under sudo, the MacPorts items appear:
51 - org.macports.mysql5
52 - org.macports.apache2
I'm not sure whether that will help, but it's a little more info nonetheless.
UPDATE
I've asked a different, but related, question at LaunchDaemons and Environment Variables. I'll update both questions as I learn more.
UPDATE
Today, based on mailing list input, I tried using a wildcard home directory. Academically, it's a little more inclusive than I'd like, but the practical reality is that I'm the only one using this computer; certainly the only one who'd have Apache config files laying around.
Include "/Users/*/Dropbox/Application Support/apache/conf.d.osx/*.conf"
Include "/Users/*/Library/Application Support/MacPorts/apache/conf.d/*.conf"
Unfortunately...
httpd: Syntax error on line 512 of /opt/local/apache2/conf/httpd.conf: Wildcard patterns not allowed in Include /Users/*/Dropbox/Application Support/apache/conf.d.osx/*.conf
I found my answer to this problem here:
https://trac.macports.org/ticket/36101
"I apparently fixed this when changing my local dnsmasq config. In /etc/hosts I added my servername (gala) to the loopback entry:
127.0.0.1 localhost gala
and then I changed ServerName in /opt/local/apache2/conf/httpd.conf to match:
ServerName gala
Apache now starts at boot for me."
Since I now know why Apache has stopped loading on startup, I'm going to articulate that answer and mark this question as answered. The reason Apache has stopped launching on boot is that I'm trying to share an httpd.conf file across systems. The config file needs to Include files from directories that exist within my home directory. Since the home directory is different on each machine, I was trying to reference the ${HOME} environment variable.
This works fine when manually starting after the machine is booted, but fails on startup because the environment variable isn't yet set. As mentioned above, see this question for more information.
Rob:
Had the same problem: "sudo launchctl load -w ..." started Apache2 while I was logged in, but did not work during startup (the "-w" should have taken care of that). Also, as you noticed, the daemon seems to be registered with launchctl. It will show up with "sudo launchctl list" and another "sudo launchctl load ..." will result in the error message.
I played with "sudo port load apache2" and "sudo port unload apache2", but could not get httpd running on reboot.
In the end, I got rid of the MacPorts startup item: "sudo port unload apache2", checked with "sudo launchctl list" that org.macports.apache2 is no longer registered for startup.
Afterwards, I followed the steps on http://diymacserver.com > Docs > Tiger > Starting Apache. I only had to adapt the path from /usr/local/... to /opt/local/...
Now the MacPorts Apache2 is starting fine with every reboot.
Good luck, Klaus
I found that my MacPorts apache2 was not starting on boot because of an “error” in my httpd.conf.
I was using
Listen 127.0.0.1:80
Listen 192.168.2.1:80
Listen 123.123.123.123:80 # Example IP, not the one I was really using
And in Console.app I was seeing
4/8/12 4:59:06.208 PM org.macports.apache2: (49)Can't assign requested address: make_sock: could not bind to address 192.168.2.1:80
4/8/12 4:59:06.208 PM org.macports.apache2: no listening sockets available, shutting down
4/8/12 4:59:06.208 PM org.macports.apache2: Unable to open logs
I tried adjusting permissions on all the log folders (despite the fact that logs were being written just fine when I manually started apache2) and that didn't help.
Even though the Apache Documentation for Listen clearly states
Multiple Listen directives may be used to specify a number of addresses and ports to listen to. The server will respond to requests from any of the listed addresses and ports.
I decided to try switching back to just using
Listen 80
And after doing so apache2 is starting on boot with no errors or warnings.
If you're using Subversion with Apache, you may find that Apache is not starting because the mod_dav_svn.so file has moved to /opt/local/libexec. You'll need to adjust your Apache startup files to account for the new location of this file.
In newer versions of MacPorts you can run sudo port load apache2 to instruct MacPorts to take care of the launchctl setup and automatically start the process. To stop the process run port unload.
After loading check /opt/local/apache2/logs/error_log for errors, including configuration issues.
In addition to my previous answer I have also found that sometimes Apache fails to start because something else with the system is not yet ready.
On one OS X Server machine I also use the DNS to create a “internal only” DNS name for the machine and that name is used in my Apache configuration. Sometimes when Apache tries to start the DNS server is not yet ready and Apache fails to load because the hostname isn’t valid.
I have also seen this on other non-Server systems without local DNS as well where something else required by Apache must not be ready yet.
One thing that has worked is to edit the apache2.wrapper located at /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper that MacPorts’ daemondo uses to start up Apache.
Edit the Start() function to add a sleep command to wait a bit before launching Apache.
Original (Lines 14-17 on my machine)
Start()
{
[ -x /opt/local/apache2/bin/apachectl ] && /opt/local/apache2/bin/apachectl start > /dev/null
}
With wait time added
Start()
{
[ -x /opt/local/apache2/bin/apachectl ] && sleep 10 && /opt/local/apache2/bin/apachectl start > /dev/null
}

Resources