Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Monday, November 11, 2019

Run php 7 project in docker container where php 5.6 project is running on Host

Run multiple php versions in docker and host with apache / Run multiple websites on php 7 docker without affecting php 5.6 of host.

If one of your php project is running on php 5.6 of ubuntu/centos/fedora, Now if you want to run another project with php 7 inside docker container. It is quite good idea to run multiple php projects on same machine.

1) Suppose you have container where apache2 and php 7 is running

2) You have already launched this container with mapped port and htdocs path.
docker run -it -v /var/www/html:/var/www/html -p 7030:80 ubuntu:16.04 /bin/bash
As our 80 port of host is already busy, php 5.6 project is running there so we mapped 80 port of docker with 7030 port of host.
We have also mounted /var/www/html of host in /var/www/html of docker. We do not need to go inside docker container to access project files, it can be accessed in html folder of host as we already mapped host and docker directory.

3) Point your subdomain to the public IP of host and add a virtualhost in apache config of host.
<VirtualHost *:80>
ServerName php7.project.com
ProxyPreserveHost On
ProxyRequests off
ProxyPass / http://127.0.0.1:7030/
ProxyPassReverse / http://127.0.0.1:7030/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
We have proxy passed to port 7030 as 80 port of docker apache is mapped with 7030 port of host.
'ProxyPreserveHost On' parameter, does not show proxy-passed ip for js and css. It keeps the servername on every page.

5) Now create a file php7project.conf in /etc/apache2/sites-available of docker-apache with following content
<VirtualHost *:80>
ServerName php7.project.com
DocumentRoot /var/www/html/projectfoldername
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

6) Enable the site.
cd /etc/apache2/sites-available
a2ensite php7project.conf

7) Now virtualhostof host apache is mapped with virtualhost of docker apache and it will open the site.
http://php7.project.com/

8) Once you make the correct database connection in your docker apache project, your site is ready to access.

Saturday, March 16, 2019

Linux Ubuntu Skype : Too Much Noise at Other End

If you are using Ubuntu operating system and other person is not able to hear you because of too much noise at his/her end. If every thing is fine at his/her end then this may be issue of your sounds settings. Here is a small tip to fix noise distortion for the person at opposite end.

In your Ubuntu Operating system, open Sound Settings. You can open this using right click at sound icon on panel or go to system settings and click on sound.
Here Under Input Tab, make the input volume selection minimum (7 to 8% of total value)
Make sure you have done this in Input tab, leave default settings for output tab.



This should solve your noise issue. 

Saturday, February 10, 2018

openedx installation on Linux | openedx installation on Ubuntu


Easy way :
1. Download the installer (.run file)
https://bitnami.com/stack/edx/installer
2. Make it executable.
chmod a+x filename.run
3. Run the installer.
./filename.run

Hard way:
Install using bash script. Why it is hard because it is gonna give many errors, you need to fix them one by one and start installing again and again until it is installed completely.
wget https://raw.githubusercontent.com/edx/configuration/$OPENEDX_RELEASE/util/install/sandbox.sh -O - | bash

You choose the version of Open edX by setting the OPENEDX_RELEASE variable before running the commands. See Open edX Releases for the tags you can use.
https://openedx.atlassian.net/wiki/spaces/DOC/pages/11108700/Open+edX+Releases
Release names like open-release/ginkgo.2, open-release/eucalyptus.3, open-release/ficus.4 etc

Example:
wget https://raw.githubusercontent.com/edx/configuration/open-release/ginkgo.2/util/install/sandbox.sh -O - | bash

Helpful url :
https://openedx.atlassian.net/wiki/spaces/OpenOPS/pages/146440579/Native+Open+edX+Ubuntu+16.04+64+bit+Installation

Hardest way:
Install each package separately like these guides are suggesting. Similar guides you can find for centos and fedora.
https://www.iblstudios.com/step-step-guide-install-open-edx-platform-ficus-release/
I would suggest you to install on virtual machine like docker, vagrant or vmware instead of start installing on your system.

Saturday, March 8, 2014

ubuntu/debian - Temporary failure resolving ‘sites in sources.list’

ubuntu/debian - Temporary failure resolving ‘sites in sources.list’

If you are trying to download packages using terminal and you are facing this error, check these things first.

If you are using proxy, proxy address should be defined in these files.
1) check /etc/apt/apt.conf file for proxy
2) check /etc/environment file for proxy


If you are not using proxy, make sure proxy settings should be removed from above files.

If above files are according to requirement and you are still facing this problem, try this solution.

Open file /etc/resolv.conf, add following line in the file and save it.
nameserver 8.8.8.8

8.8.8.8 is google's public DNS address.


Now restart networking and try to install packages again.

Friday, February 22, 2013

Install FTP on Linux : CentOS, RHEL, UBUNTU

vsftpd Configuration :


1) Install vsftpd using following command :
   If it is Debian based (Ubuntu) Linux
$ sudo apt-get install vsftpd

   If it is RPM based (CentOS, RHEL) Linux
$ sudo yum install vsftpd

2) Make three changes in vsftpd.conf
   (Location of vsftpd.conf - /etc/vsftpd.conf or /etc/vsftpd/vsftpd.conf)

a)Uncomment line chroot_local_user=YES in vsftpd.conf
   This attribute will make jail for user to not move to the parent directory.

b)Define attribute local_root in vsftpd.conf
local_root=/opt/lampp/htdocs

This is the path of the directory where user should be jailed. User can not go to the parent directory.In this example user will be logged in htdocs and can not reach to the parent directory of htdocs. 

c)Allow users to upload file, set
local_enable=YES
write_enable_YES
Now user can log-in to the server by ftp using username and password.

host : IP of the server
username : user of the server except root
password : password of the user

3) To create user for ftp :
 

$ sudo adduser -c 'FTP USER ec2' -m ec2

   Where ec2 is the username for ftp. To set password for this user :
$ sudo passwd ec2

4) FTP works on port 21. you can close the port or stop the service using 
$ service vsftpd stop

   and open the port or start the service using
$ service vsftpd start

5) If you are using CentOS/RHEL servers, Add following line in your iptables file 
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT

Path of iptables file :/etc/sysconfig/iptables

   Save and close the file & Restart the iptables. 
$ service iptables restart

6) To prevent anonymous log-in, Set anonymous_enable=NO
 In vsftpd.conf, if anonymous_enable=YES, There is no need to put username & password. If you put only hostname and try to log-in, you can log-in.
For security purpose, make sure you have set this attribute NO.

7) By default root user can not log-in by ftp but log-in through sftp.

8) When you make any changes in the file vsftpd.conf, make sure you have restarted the vsftpd.