Apache Web Development on Cygwin - apache

I'm trying to get an Apache server running on my Cygwin setup to follow the Java Ranch Cattle Drive tutorials online (basically, to learn Java EE web page development that uses a MySQL back end.)
I used the Cygwin Setup program to install httpd (which is how I installed most other dev tools I use on cygwin) and it says install complete, yet when I run 'httpd' it cannot find the command. It also appears the expected install directory (/usr/local/apache...) doesn't exist.
Does anyone have any experience using this setup, and if so, you could walk me through the initial steps of getting the server up and running and getting a browser to display the server's default page?
To keep answers focused, I didn't want to discus the drawbacks of running Apache on a Windows system - this is just for learning purposes. Thanks in advance.

Looking at the Cygwin Package Listing for httpd, you can see that the executable is installed under /usr/sbin.
So, if /usr/sbin is not on your PATH (it isn't on mine, not by default anyhow), you would actually run:
/usr/sbin/httpd
And btw, if you would like to list the files installed for a certain package, you can use cygcheck:
cygcheck -l httpd

cygrunsrv -I Apache -p /usr/sbin/httpd -a "-X"
This will solve the problem. This assumes you already have cyrunsrv set up. The reason httpd fails with cygrunsrv if you leave out the -X is that the process disconnects from the terminal and cygrunsrv considers that a failure. The -X option for httpd is the debug or terminal mode.

I couldn't find any detailed information on how to get Apache working on Cygwin, so here it is if someone's interested:
Install the httpd-* and httpd-mod_* packages you need. Note that the packages named "Apache" are deprecated. You need the ones named "httpd" (which are actually Apache).
Install cygrunsrv (normally this is a default Cygwin package)
Run /usr/bin/cygserver-config as admin. This is needed because Apache requires an IPC server running.
Open services.msc, then go to the CYGWIN Cygserver. Right-click on it and start it. If you don't do this, you'll probably get errors like "AH00023: Couldn't create the proxy mutex".
Finally, start Apache by running /usr/sbin/apachectl restart
Config is in /etc/httpd/.

Some information about running Apache on Cygwin:
http://httpd.apache.org/docs/1.3/cygwin.html
http://www.issociate.de/board/goto/895433/apache2_does_not_start_in_cygwin.html
http://www.cygwin.com/ml/cygwin-apps/2005-02/msg00085.html
Personally, I would recommend installing WAMPServer or other WAMP stack and do it that way. There is no difference, except that you'll need to control Apache through Windows commands [net start, net stop], not Cygwin's ones.

Related

install weblogic on VM with Solaris OS

I stuck in install weblogic on my vm solaris. i try that
java -d64 -jar fmw_12.2.1.3.0_wls.jar
and i got an error
Checking monitor: must be configured to display at least 256 colors. DISPLAY environment variable not set. Failed <<<<
Any solution for these error?
This happens if you want to do an graphical install of the system without having a X11 running. The error message is quite normal for such an situation.
You could:
Not running the installer in the graphical mode by doing a silent install (please refer to https://docs.oracle.com/cd/E24329_01/doc.1211/e24492/silent.htm#WLSIG131 for information)
Install the nescessary package to have an X11 and stuff running in your VM with pkg install solaris-desktop. Then execute the java command again from the GUI . This obviously only works if you can get a the graphical output of the VM for example via VNC or other tools.
You could set the DISPLAY variable to an installed X11 implementation. For example i use Xquartz on my Apple notebook. Then configure DISPLAY and XAUTHORITY correctly. Or you could simply log into the Solaris system with ssh -X . I prefer the second one, as it does everything automatically.

problems with ubiquity/success_command Ubuntu 14.04

I want to automate the Ubuntu installation (a fully unattended installation without questions). I also want to run a script right after the installation is finished.
What I did is that I managed to have a fully unattended Ubuntu installation. I am doing this by providing a pre-seed file and using boot parameters to preseed the questions that are asked before the preseed file is loaded. The installation went okay but the problem lies with running the script right after the installation completion. I am using Ubuntu 14.04 LTS desktop version thus I am not using the late command as I have read that it won't be noticed by the installer. Instead, I am using the Ubiquity/success_command. I have the following code at the end of my pre-seed file.
ubiquity ubiquity/success_command string \
mkdir /target/dev-master/; \
cp -r /cdrom/dev-master/* /target/dev-master/; \
chroot /target bash /dev-master/SCRIPT;
The problem is nothing happens. I think the command went unnoticed as well.
I am not sure if I am approaching the problem correctly.
What am I doing wrong ?
Is there any other alternatives that might provide the desired result ? Any help would be appreciated and thanks.

How to install mod_cloudflare for easyapache 4

I am trying to install mod_cloudflare for Apache using easyapache 4 on cPanel Server. I am running CentOS 7.2.
I have installed mod_cloudflare for EasyApache4 following the instructions under Option 2 here. After running the installer it said "Done. Please restart EasyApache 4". I then went into WHM -> EasyApache 4 and tried to find the server module, but it is not to be found. I clicked the "run system update" button and tried again, to no avail. Is there an easyapache service that needs to be restarted via the command line?
I am not a hosting provider so I have not tried the Cloudflare plugin for CPanel.
* Edit 4/9/2019 *
Changing accepted answer to EasyCo's, as the original solution no longer works.
Figured I'd throw my solution into the mix using Centos 6.9 with WHM/cPanel.
bash <(curl -s https://raw.githubusercontent.com/cloudflare/mod_cloudflare/master/EasyApache/installer.sh)
wget https://raw.githubusercontent.com/cloudflare/mod_cloudflare/master/mod_cloudflare.c
yum install ea-apache24-devel
apxs -a -i -c mod_cloudflare.c
rm /etc/apache2/conf.modules.d/mod_cloudflare.conf
service httpd restart
What's happening?
We're using the cPanel installer.sh as suggested by Cloudflare but the compiled mod_cloudflare.so throws an error if you then run service httpd restart. Lets fix this.
Download the source mod_cloudflare file.
Ensure we have the correct EasyApache4 developer tools to build the mod_cloudflare module.
Build and install extension module.
Remove the new mod_cloudfare.conf file since we prefer the one that was generated and installed in step 1.
Restart apache.
Note: The mod_cloudflare module will not show in EasyApache4. You can see it's enabled by running httpd -M | grep cloudflare and you should see something like cloudflare_module (shared).
References:
https://www.cloudflare.com/technical-resources/
https://community.cloudflare.com/t/help-installing-mod-cloudflare/1747/12
http://www.marathon-studios.com/blog/issues-installing-mod_cloudflare-on-centos-7/
https://forums.cpanel.net/threads/install-httpd-devel.594631/#post-2405975
I found a solution that worked perfectly.
This github project installs the module and adds it into EasyApache so that future rebuilds keep the module active. This was the only solution I found that actually works for EasyApache 4. Everything else seems to be for EasyApache 3.
CloudFlare was not much help with this either, as they had suggested I contact my hosting provider for assistance.
I know this is a bit old now, but it's the first answer that shows up in google.
The official cloudflare answer does work, it just doesn't show up in the EA4 list of modules. However it is installed and working.
Just for others like me that reached here recently, mod_cloudflare module is deprecated and there is a native module for apache [mod_remoteip]. I can see it in EasyApache (apache module section). Also There is a manual here to install & config :
https://support.cloudflare.com/hc/en-us/articles/200170786-Restoring-original-visitor-IPs
with this module you can see Client IP through
$_SERVER['REMOTE_ADDR']
And there is no need to
$_SERVER['HTTP_CF_CONNECTING_IP']
Instructions for installing mod_cloudflare on cPanel with EasyApache4 can be found here:
https://support.cloudflare.com/hc/en-us/articles/206175737-How-do-I-restore-original-visitor-IP-with-EasyApache-cPanel-
bash <(curl -s https://raw.githubusercontent.com/cloudflare/mod_cloudflare/master/EasyApache/installer.sh)

Fedora how to automatically run the ssh daemon

I would like to know what are the ways to automatically start daemons (sshd) in Fedora system. I know I can write a startup script that will put on /etc/init.d/.
What are the other options?
Somewhere I read that now in the new version of this can be done using the commands in the terminal, but I do not remember what it was.
EDIT: My 2 question.
I install ssh from source. When keys are generated for a server? During the installation?
You can do this via systemctl:
systemctl enable sshd.service

How can I run xsp4 as a background process on linux?

Is there an easy way to get xsp4 running as a background process on a linux server?
When I run xsp4 I get this:
xsp4
Listening on address: 0.0.0.0
Root directory: /test
Listening on port: 80 (non-secure)
Hit Return to stop the server.
So if I quit the terminal I am running it from it stops the server.
Do I have to write a daemon to do this? Or is there already something in place that I am missing?
Thanks
You have a couple of options. If your problem is terminal closing, then screen can be simple solution (just run screen xsp4, then Ctrl+A,D and you can close terminal). If the method you have used suits you, then use it -- however xsp will die after terminal closing. xsp should be generally used for debugging, production solutions are FastCGI or apache module, so these are daemons "by definition".
I had to use Mono for a demo that I had to show, and faced the same problem. My workaround was:
xsp4 --nonstop &
Note: It will show the initial information and if you hit enter, it will continue running. You can also exit the terminal if you want and it will continue as well.
you can do install the xsp4 in the terminal
sudo apt-get install mono-xsp4
then
go to your project Folder where the Asp project saved and type in the terminal
xsp4