WHAT'S NEW?
Loading...
Showing posts with label tutorial. Show all posts
Showing posts with label tutorial. Show all posts
Sometimes you need to migrate a new website from the root directory of the domain, for example you want move your website from http://www.mydomain.com to http://www.mydomain.com/wordpress/
If you need help follow the instructions below.


Backup all the WordPress files and MySql script onto your local drive

Create the new location for the core WordPress files to be stored, create the subfolder in the htdocs of the Apache installation: $APACHE_HOME\htdocs\wordpress

Copy or move all the files and subfolders in the new folder.

Change all the references in the .htaccess file. It is a hidden file and should be located in the root folder for WordPress.

Login to phpMyAdmin, click the link to your wordpress database and  look for the table "wp_options", open the table and watch the "option_name" column, scroll down and look for "siteurl" and "home". Change the value from  http://www.mydomain.com to http://www.mydomain.com/wordpress/

Login to the new wordpress url: http://www.mydomain.com/wordpress/wp-login.php 

If you are using Permalinks, go to the Administration > Settings > Permalinks panel and click UPDATE

Now we must modify the existing image/media links uploaded media, you must install the Better Search Replace plugin and activate it https://wordpress.org/plugins/better-search-replace/ 
Open the menu Tools -->  Better Search Replace


Write in the "Search for": http://www.mydomain.com

Write in the "Replace with": http://www.mydomain.com/wordpress/

Select the checkbox you want and click "Run Search/Replace"

You have now completely moved your wordpress instance in the subfolder.

If you continue to have 404 error on permalinks then check if

AllowOverride Not Enabled 

Your server may not have the AllowOverride directive enabled. If the AllowOverride directive is set to None in your Apache httpd.config file, then .htaccess files are completely ignored. In this case, the server will not even attempt to read .htaccessfiles in the filesystem. When this directive is set to All, then any directive which has the .htaccess Context is allowed in .htaccess files. Example of enabled AllowOverride directive in httpd.config:
 <Directory />
    Options FollowSymLinks
    AllowOverride All
 </Directory>
You may also have to enable the AllowOverride directive in your DocumentRoot:
 <Directory /var/www/html>
    # ... other directives...
    AllowOverride All
 </Directory>
VirtualHost example

<VirtualHost IP>
    ServerName domain.com
    ServerAlias www.domain.com
    DocumentRoot /var/www/mydomain
    ServerAdmin webmaster@domain.com
   <Directory "/var/www/mydomain">
         Options FollowSymLinks
         AllowOverride All
         Order allow,deny
         Allow from all
   </Directory>
</VirtualHost>
Suppose you have successfull setup up your local webserver Tomcat or a simple Node.js HTTP server available locally through http://localhost:8080 and now you need to access Raspberry Pi from outside from LAN, then you are in the right place! This easy tutorial is for you.

The WiFi Router of your LAN has an external IP address which it uses to communicate with the internet, let's take a look at how to find. You can obtain the IP by querying Google with this url

https://www.google.com/search?q=my+ip


The result should be something like 80.76.56.11

Now get the local LAN IP address assigned to your Raspberry Pi by typing this command in the terminal window:

ifconfig

On the resulting text, you find the IP address after "inet addr:" for example 192.168.1.6

Configure the WiFi Router
  • connect using browser to http://192.168.1.1/ (the default address of your router) and then log in by using your router's user name and password. 
  • search "Port Forwarding" section (Port Forwarding is the ability to open ports in your router and re-direct data through those ports to a single PC on your network)  


  • give a name to the new rule (webserver). Type the Raspberry Pi LAN ip address. Choose the protocol as TCP. Type in external port 80 (the port number available for Internet connections) and internal 8080 (the port number for your webserver on the Raspberry Pi). Click on Add or Apply to save the rule. 

Test the configuration by opening a browser from your PC o your smartphone and going to your public IP.

http://YourPublicIpAddress in this tutorial example for me is http://80.76.56.11

If all is well, you should see the html hosted on your local Raspberry Pi appear in your browser.
Most of you surely have a USB webcam that you used in the past and then thrown away in some corner because it has become old or because you changed your PC. Nowadays, most of the computer is supplied as a standard webcam and no longer needs to buy and to be connected externally. What to do with this old hardware? If you have a device Raspberry Pi, you can reuse your old webcam to build something useful again.


Turn on your Raspberry Pi, open a terminal window, connect the webcam into the USB port and enter the following command that will list all the USB devices that are being connected.

lsusb

you should see your camera listed as a usb device, for example

Bus 001 Device 006: ID 0c45:602c Microdia Clas Ohlson TWC-30XOP Webcam

if webcam is not in the list then you are not lucky, your webcam is not compatible with Raspberry Pi. If your Webcam is compatible, you can try to take some pictures to verify its functionality by installing fswebcam software.

sudo apt-get install fswebcam

Now run this command to capture a picture from the USB Webcam and save it as testimage.jpg

fswebcam testimage.jpg

You can run fswebcam with many switches, type the following command to have more options

man fswebcam

That is all! Your webcam setup is complete, but if you want experiment more with your webcam continue to read. Now we will install another very useful software to stream the video signal via web interface. The program name is "Motion" and you can read all the documentation here.

apt-get install motion

Now edit two configuration files

sudo nano /etc/default/motion

Change the following value from NO to YES

start_motion_daemon=no --> start_motion_daemon=yes

Press Ctrl+O to save and type Ctrl+X to exit.

sudo nano /etc/motion/motion.conf

This is quite a large conf file but the points you need to edit are:
daemon on
stream_localhost off
webcontrol_localhost off

############################################################
# Daemon
############################################################
# Start in daemon (background) mode and release terminal (default: off)
daemon on
############################################################

############################################################
# Live Stream Server
############################################################
# Restrict stream connections to localhost only (default: on)
stream_localhost off
##############################################################

############################################################
# HTTP Based Control
############################################################
# Restrict control connections to localhost only (default: on)
webcontrol_localhost off
#############################################################

Press Ctrl+O to save and type Ctrl+X to exit.

Then start the program by typing

sudo service motion start

sudo motion

To see if all is runnging type

sudo netstat -tulpn | grep LISTEN

Ports are showing as listening:
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:8081            0.0.0.0:*               LISTEN

Now get the local IP address of the Raspberry PI with command

ifconfig

On the second line of the resulting text, you find the IP address after "inet addr:" for example 192.168.1.6

Now visit the address http://YourIpAddress:8081 in your browser and you should get the Webcam stream. In my example i do http://192.168.1.6:8081 

You will see your Webcam stream into the browser from every pc in your LAN! 

Do you want to make available the display of your webcam directly on the Internet? Follow this tutorial.

Did you have trouble configuring the program files "motion"? Watch the video to get some help.