modifying the flow of the apache web server - apache

I'm decoding video get via http using gstreamer. To do that I've stored multimedia files (ogg, mp4) in my apache htdocs directory. And then I can decode them with gstreamer using the following pipeline command :
gst-launch souphttpsrc location=http://localhost/data/ ! oggdemux ! vorbisdec ! audioconverter ! autoaudiosink
In order to simulate the lost of paquets in an heavy load network connection. I wounder if it is possible to configure the trafic of the Apache web server to drop some specific paquets (from ogg or mp4 for example) or slow down the flow?
What I need to do in order to archive that.
I'm using Apache 2 install in xampp.
thanks for any reply.

Finally it get the answer from this other question here. It's not the web server to do that but the system and in my case It's Linux who will do that using the command tc
sudo tc qdisc change dev eth0 root netem loss 0.1%|
for example

Related

tftp in libvirt hosts behind nat

I am trying to download a configuration file, which will automate os installation, from a tftp server to a libvirt virtual macine guest . I can download file from host without problem but it can not be download in guestos. From guesos, I can ping the server, the curl -O tftp://serverip/file command stucks. I can see that the server is accessed but somehow tftp protocol related traffic is not being forwarded completely I believe.
I have found an old post at tftp-for-libvirt-hosts-behind-nat, I have changed nic card to e1000, but the behaviour has not changed.
Another post at iptables rules to forward tftp via NAT which is completely foreing to me.
Any help much appreciated.

Cannot access Open VPN Management Console via Port Forwarding

I just set up OpenVPN on my Raspberry running headless Raspbian with the server config file provided by my VPN Provider "IP Vanish" and appended the following line in the config file:
management 127.0.0.1 6001 stdin
Afterwards I started the service like this:
sudo openvpn --config PATH/ipvanish-XXX.ovpn
IP Checks yielded that the connection is established as desired.
I want to access the management portal from my Macbook on the same network using port forwarding:
ssh -i XXX.pem -L 3000:localhost:6001 pi#192.168.1.9
The login works fine, but when I go to 127.0.0.1:3000 Safari says
Cancelled load because it is using HTTP/0.9
and Chrome just says that it send an invalid response.
My google research on the "HTTP/0.9" issue didn't really get me anywhere. Is the protocol used for the management portal just too old or what's the real issue here?
Many thanks in advance for any help!
Obviously, I missed that the management interface for openvpn is a COMMAND LINE interface.
A connection with e.g.
nc 127.0.0.1 6001
works just fine.
This answer just in case someone else is under the false assumption, it's a web interface.

How to disable NFS client caching?

I have a trouble with NFS client file caching. The client read the file which was removed from the server many minutes before.
My two servers are both CentOS 6.5 (kernel: 2.6.32-431.el6.x86_64)
I'm using server A as the NFS server, /etc/exports is written as:
/path/folder 192.168.1.20(rw,no_root_squash,no_all_squash,sync)
And server B is used as the client, the mount options are:
nfsstat -m
/mnt/folder from 192.168.1.7:/path/folder
Flags: rw,sync,relatime,vers=4,rsize=1048576,wsize=1048576,namlen=255,acregmin=0,acregmax=0,acdirmin=0,acdirmax=0,hard,noac,nosharecache,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=192.168.1.20,minorversion=0,lookupcache=none,local_lock=none,addr=192.168.1.7
As you can see, "lookupcache=none,noac" options are already used to disable the caching, but seems doesn't work...
I did the following steps:
Create a simple text file from server A
Print the file from the server B by cmd "cat", and it's there
Remove the file from the server A
Wait couple minutes and print the file from the server B, and it's still there!
But if I do "ls" from the server B at that time, the file is not in the output. The inconsistent state may last a few minutes.
I think I've checked all the NFS mount options...but can't find the solution.
Is there any other options I missed? Or maybe the issue is not about NFS?
Any ideas would be appreciated :)
I have tested the same steps you have given with below parameters. Its working perfectly. I have added one more parameter "fg" in the client side mounting.
sudo mount -t nfs -o fg,noac,lookupcache=none XXX.XX.XX.XX:/var/shared/ /mnt/nfs/fuse-shared/

Apache script config with loggly

I am trying to configure loggly in apache in my ubuntu machine.
What I have done is
curl -O https://www.loggly.com/install/configure-apache.sh
sudo bash configure-apache.sh -a XXXXXX -u XXXXXX
After entering the last line it's saying
ERROR: Apache logs did not make to Loggly in time. Please check network and firewall settings and retry.
Manual instructions to configure Apache2 is available at https://www.loggly.com/docs/sending-apache-logs/. Rsyslog troubleshooting instructions are available at https://www.loggly.com/docs/troubleshooting-rsyslog/
Any idea why it's showing and how to solve it?
This is likely a network issue or a delay in sending the logs or even an issue with the script. Check out the following link that has the manual instructions. https://www.loggly.com/docs/sending-apache-logs/ that you can follow and use to verify the script created the configuration files correctly.

How can I play a wav sound on the server side using cgi?

How can I run a command from a (bash) CGI script to play a wav sound on the server side?
You can execute your command line audio player as described by nak, but this may not work due to the permissions of the user running Apache. By default Apache is run as www-data:www-data (or apache:apache or www:www on some distros). As a quick fix/test you can set Apache to run as a user that has permissions to access the audio device on the machine by modifying your /etc/apache2/apache2.conf (or /etc/httpd/httpd.conf") file to have:
User USER_THAT_CAN_PLAY_AUDIO
Group USER_THAT_CAN_PLAY_AUDIO
Warning: this is not secure and is not intended to be a permanent solution!
This is how I would do it
#!/bin/sh
echo Content-type: text/plain
echo ""
echo "Server is playing sine.wav!"
aplay -q sine.wav
I stumbled over this old question looking how to solve the same problem: to have my personal Apache webserver warning me when someone makes a specific request (in my case a call for chat without the need to have any IM running).
The solution below is what I use on Slackware 14.1: according to your distro YMMV.
launch visudo
add the line TheUserRunningApache ALL=(ALL) NOPASSWD: /usr/bin/play (TheUserRunningApache is the user name used by your Apache)
In the PHP page you want to play a sound add this line: system ("sudo /usr/bin/play SOUND.WAV");
If you don't want to give access to Apache to the /usr/bin folder, even if limited just to play, you can copy the sox executable (the program used to run /usr/bin/play) elsewhere, but you'll have to modify the last two instructions above accordingly.