Denwer apache restart - apache

I often restart apache during development e.g. for doggling on/off x-debug, update Doctrine cache...
Uppon installation Denwer puts 3 shortcuts on desktop Start Denwer, Stop Denwer and Restart Denwer. Those are pointed to appropriate .exe files. However Restart Denwer restarts all services including MySQL, hosts file, mail daemon which takes 10 sec+.
How can I restart apache only?

apache-restart.bat
cd /d z:\denwer\scripts\init.d
z:\usr\local\miniperl\miniperl.exe apache.pl restart

Related

MAMP 6.7 won't start on port 80

I just upgraded to MAMP version 6.7, to get php 8, it won't start on port 80 from GUI but it starts from command line with /Applications/MAMP/Library/bin/apachectl start (no error messages). Previous version of MAMP (5.7) was running without any problems).
I do not have any other applikation running on port 80 (did: ps aux | grep httpd ).
I do not get any error message in MAMPs error log.
I can start MAMP Apache server on any other port.
I had deactivated Macs own Apaoche server with:
sudo launchctl unload /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
Installed new version off MAMP, copied over config files for mysql to bin (as I have password for mysql server), configurated phpMyAdmin for http login and no password, chosed php 8.20 in GUI for starting MAMP, checked that port 80 for Apache and 3306 from mysql was configurated, started server.
Edit: It was something about the admin rights on the log files in MAMP/logs (was set to: root as user and admin as group), so I changed permission on apache_error file. to my username (as I i have apache running under it) and read write for group admin, still server do not start.
It is something about the password prompt for the main GUI that not get trigged, I actually want to have that prompt when I start the MAMP servers.
Any ideas?
I upgrade to new version 6.8 of MAMP now who just come out, and that solved the problem, Apache starts and i get the prompt for password when using port 80.
The upgrade process is quite stupid though, IT DID NOT TAKE BACKUP on config files and database, when it wrote the date named backup files for old installation in Applications. Gladly I have strong routine on backup both by hand and in my system setup. So had to copy over config files for mySql (in bin directory) and database directory(in db directory). Need to do this on every new installation of MAMP.
This is stupid MAMP, fix it!

Stop High Sierra's httpd/apache and use Homebrews?

I want to use Homebrew's version of Apache on my Mac so I can start/stop it as I please, so I've been trying all afternoon to stop and unload several httpd processes that are run by user _www on macOS 10.13.3 High Sierra without any luck.
See the screenshot attached, there are 6 httpd processes run by _www and the single process run under root (Homebrew service)
I've tried
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
which gives me an error:
/System/Library/LaunchDaemons/org.apache.httpd.plist: Could not find specified service
I've also tried tracking the process starting them down, switching user to _www (a no no) so I can see where it's being started and so far I'm having no luck.
I want to kill them all, and have them stay dead as right now they're conflicting with the server I'm actually trying to run. Anyone cleverer than me out there that knows how to kill this literal http demon?
https://stackoverflow.com/a/20439859/996338
Try this:
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
This will stop a running instance of Apache, and record that it should not be restarted. It records your preference in /private/var/db/launchd.db/com.apple.launchd/overrides.plist.
For a single session (meaning, between reboots), you can use sudo apachectl stop.

Can't restart kestrel

I am using supervisor to run the kestrel process on Ubuntu 14.04.
Here is my supervisor config:
[program:website]
command=/usr/bin/dotnet /var/www/publish/Website.dll
directory=/var/www/publish/
autostart=true
autorestart=true
stderr_logfile=/var/www/website.err.log
stdout_logfile=/var/www/website.out.log
environment=ASPNETCORE_ENVIRONMENT=Production
user=www-data
stopasgroup=true
stopsignal=INT
I have tried sudo service restart supervisor and supervisorctl restart website.
They both say they are stopping and starting process but my uploaded changes are not detected, it seems kestrel carries on running unaffected.
The only way I have of getting my changes to reflect is to restart the entire server which is inconvenient.
What is a better way for me to restart kestrel?

How to keep redis server running

I am using redis for session support in nodejs app. I have installed redis server and it works when I run redis-server, but when I close terminal redis stops and does not work. How do I keep redis server running after closing the terminal?
And, if you'd like a quick option, run: redis-server --daemonize yes.
The easiest way to launch Redis as a daemon is to edit the configuration file and change the following line:
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize yes
Be sure to provide the configuration file on the redis-server command line when you launch it.
An example of configuration file is provided in the Redis distribution.
As mentioned by #DidierSpezia in his answer,
Set daemonize yes in Redis conf file.
Set daemonize yes in Redis conf file at /path/to/redis.conf Generally
it should be there at /etc/.
And :
Then trigger redis-server with the conf file as an argument:
./redis-server /etc/redis.conf
UPDATE
You may directly run the redis with demonize flag as well
redis-server --daemonize yes
The accepted answer is mostly outdated.
While the question is old, Google still ranks this highly, so allow me to correct this.
The OP did not provide any detail about his setup, but you can assume it is a linux, and he doesn't mention containers, so you can also assume he is running redis without them.
There is three detail that make the accepted answer a thing to forget
Most (popular) distros come with systemd by default
Most (popular) distros have redis in their official repos
that official redis package installs systemd service for redis
So
It will have supervised systemd in its default config
To start: the redis daemon with sudo systemctl start redis#instanceName where you substitue "instanceName". Also sudo systemctl enable redis#instanceName for auto-starting on boot. (BTW, forget about service start, and init scripts already! These are less portable nowdays than calling directly systemctl).
do NOT set to daemonize: yes, that will interfere with the systemd supervisioning redis!
Systemd will supervise, restart your redis, and you can set service depenedencies and service preconditions to/for it, even for a custom executable it is not that hard, search for systemd unit files (you'll need a ~10 lines config file). Chances are, you'd want it.
If the three detail (making systemd the correct answer) are not met/relevant, you are most likely running redis containerized. For docker/podman/etc., it is another question altogether... (no systemd in the inner linux, but you'd have to (or already do) supervise(d) the container-daemon itself)

How to install two Apache services

I would like two install two different apache2.2 services on a Windows machine. I already have one installed and running on ports 80 and 443. I copied the server installation directory and pasted it some where else. I went into httpd.conf and changed it from Listen 80 to Listen 8000. I also changed the Listen 443 to Listen 8001.
I can install it as a service, but it says there is an error in httpd.conf.
When I try to start the service it says:
make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down
Nowhere in the config file does it say to listen to port 80.
What could cause this?
EDIT
I found that if I changed the config file in the original Apache installation that I copied, it would change the error message.
For example I changed the original config files to listen on ports not in use and the error messages, when I try to start the new Apache service, would go away. However, in task manager it did not show the Service as running but as STOPPED.
I uninstalled the service and re-installed it using the -f flag to point to the correct config file and nothing changed. It seems there must be internal pointers or something that are kept when I copied it?
I also tried installing Apache from a .msi installer and it wont install because I already have an apache installation.
SECOND EDIT
Wish I would have seen this earlier. According to Using Apache HTTP Server on Microsoft Windows I may need to build Apache from source.
Note that you cannot install two versions of Apache 2.3 on the same computer with the binary installer. You can, however, install a version of the 1.3 series and a version of the 2.3 series on the same computer without problems. If you need to have two different 2.3 versions on the same computer, you have to compile and install Apache from the source.
I have never done something like this could some one perhaps explain this a little more clearly?
The solution was going into the original Apache install directory and running:
C:\original-apache-install\bin> httpd -k install -n "new service name" -f "new/config/file/location"
Just copying the installation and pasting somewhere else kept ties to the original config file and did not let me change what it pointed to. When I ran the above command in the new install directory it did not work. Example:
C:\new-pasted-apache\bin> httpd -k install -n "new service name" -f "new/config/file/location"
I successfully installed two different 2.4.x versions of apache by installing both services separately with the command that was already mentioned:
C:\Apache2.4.23> httpd -k install -n "Apache2.4.23" -f "C:/Apache2.4.23/conf/httpd.conf"
C:\Apache2.4.12\bin> httpd -k install -n "Apache2.4.12" -f "C:/Apache2.4.12/conf/httpd.conf"
When i checked both services in the "Services" interfaces of windows i noticed that the seconds service had the same executable path as the first installed service. I fixed that by editing the service via regedit (since the sc command did not accept the parameter "-k runservice" that is appended to the executable path):
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
See: https://superuser.com/questions/222238/how-to-change-path-to-executable-for-a-windows-service/252850#252850