Apache commands with 2nd instance on Mac OS X - apache

I have a Mac OS X 10.9/Mavericks Mac which I have just installed FileMaker Server v13. The FileMaker Server installer creates its own instance of the Apache web server and configures this web server to use port 80 for HTTP and port 443 for HTTPS. The document root for this instance is located at:
/Library/FileMaker Server/HTTPServer/htdocs
I'm trying to use the Apache commands via the Mac OS X Terminal to stop/start/restart this instance but it looks like it's trying to use the standard OS X Apache not the FileMaker Server installed instance.
For example I would like to use:
sudo apachetctl restart
When there are 2 instances of Apache installed how do you specify which instance you wish to command?

Finally found the answer. The following syntax will work:
sudo /Library/Filemaker\ Server/HTTPServer/bin/httpdctl graceful

If you want to keep your OS Apache running it needs to be on a different port. FileMaker doesn't really support console commands and wants you to restart the computer to restart apache.
You can try with the launchctl:
sudo launchctl stop com.filemaker.fms
sudo launchctl start com.filemaker.fms
Or you can try to run httpd and specify the 2nd file directly
/usr/sbin/httpd -f /Library/FileMaker\ Server/HTTPServer/conf/httpd.conf -t

if you you want to restart FileMaker Server you should use this commands in Terminal :
fmsadmin start server
fmsadmin stop server
fmsadmin restart server

Related

Installed lamp on ubuntu server on an ec2 amazon instance, still can't access server through browser with apache running. Why?

I started an instance on amazon ec2, ami is ubuntu 14.04. I followed the steps on https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html exactly up until "Transferring Files to Your Linux Instance Using the PuTTY Secure Copy Client" Since I don't need to put files on there just yet. Then I followed the following: https://help.ubuntu.com/community/ApacheMySQLPHP.
"To install the default LAMP stack in Ubuntu 10.04 and above
First refresh your package index...
$ sudo apt-get update
... and then install the LAMP stack:
$ sudo apt-get install lamp-server^
Mind the caret (^) at the end. "
After that I tried
sudo /etc/init.d/apache2 restart
After which ubuntu said: httpd (pid 5549) already running
Yet when I try to browse with chrome to the public ip which shows in the amazon console I get
This webpage is not available
ERR_CONNECTION_TIMED_OUT
In my browser. What am I doing wrong?
check your security group settings. What are the inbound rules?
You need to add the IP(s) from where you are opening the web browser in the inbound rules. Also, check whether you are using private IP or public IP on the browser. You need to use public IP.

How to switch between two Apache installations?

Some time ago I installed Apache 2.2.29 with this manual:
https://echo.co/blog/os-x-1010-yosemite-local-development-environment-apache-php-and-mysql-homebrew
into this directory:
/usr/local/Cellar/httpd22/2.2.29/bin/httpd
Yesterday I installed Apache 2.4.17 with this manual:
https://www.youtube.com/watch?v=hV52Vs4E1xs
into this directory:
/usr/local/apache2/bin/httpd
Terminal command
which httpd
shows me this:
Server version: Apache/2.2.29 (Unix)
is there any way to switch to 2.4.17?
(I'm on OS X 10.10.5)
Yes of course. Just specify the absolute path.
For example to stop Apache 2.2.9 use the following command:
/usr/local/Cellar/httpd22/2.2.29/bin/apachectl -k stop
Give it a few seconds or use 'ps' to check its finished shutting down and then use the following to start up the 2.4.17 instance:
/usr/local/apache2/bin/apachectl -k start
Note when you machine restarts it my revert to the old version depending what's in its start up scripts.
Also any config will be specific to each installation so you might find they don't point to the same DocumentRoot so don't display the same website.
You cannot run both under port 80 at the same time. However you could run one under port 80 and one under another port of you wanted both running at exactly the same time.

How to restart apache server through cygwin and ssh

The scenario is this: I have an Apache web server installed on a Windows 7 machine. The same machine has cygwin installed, and cygwin is configured with ssh. This allows me to ssh into cygwin remotely, and then, through cygwin, I can access other files on this computer (even those not in cygdrive).
My question: How can I restart the web server through cygwin if I am accessing it remotely through ssh? Is it possible? Thanks
If your service is called Apache, then like this:
ssh machine "net stop Apache; net start Apache"
Sometimes it is called Apache2 or httpd, depending on your distro.
In linux is
$ sudo service apache2 restart
or
$ sudo /etc/init.d/apache2 restart
See: http://httpd.apache.org/docs/2.2/platform/windows.html#winsvc
and http://httpd.apache.org/docs/2.2/platform/windows.html#wincons
You can try this one
$ service httpd restart
or
$ /etc/init.d/httpd restart

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

Why does running "apachectl -k start" not work, but "sudo apachectl -k start" does?

I'm working on my OS X with the default installation of Apache. For some reason, when I run the "apachectl" command without the "sudo" I get "no listening sockets available / unable to open logs." I'm guessing this is a permissioning thing, so can someone help me out? I'm using Apache 2.2.
Also, side question, where the the Apache script file that is basically the "exe" that linux executes? I'm trying to intergrate my server with Aptana Studio, and it requires the path to the Apache install. I know in Windows, this would be "C:\path\to\httpd.exe", but I don't know how this works in linux.
Is your server listening on port 80? (Usually) only root is allowed to open ports below 1024. Hence the need for sudo.
As you can see, lots of people wonder how to get around this. One possible solution is to perform port-forwarding on your router. (I'm assuming here that you are behind a router...). Then incoming connections on port 80 can be forwarded to e.g. port 8080. Thus only locally does one need to connect to port 8080. (There may be more elegant solutions... somebody else will post them.)
I think generally (on both OS X and Linux - I'm not sure which one you're referring to) the httpd binary is located at: /usr/sbin/httpd
If you need to be able to restart Apache, and you can't do so as root (for whatever reason..), then you may have to settle for a non 'well known' port.
try this
(with php)
$a = shell_exec('sudo -u root -S /etc/init.d/apache2 restart < /home/$user/passfile');
password should stored in passfile