20
FROM DEVELOPMENT TO PRODUCTION AN EVIL PLAN IN WORDPRESS [email protected]

FROM DEVELOPMENT TO PRODUCTIONfiles.meetup.com/20132567/wp-sviluppo-produzione.pdf · INSTALL WP – BITNAMI Only 1 wordpress per XAMPP Wordpress will be installed in a “wordpress”

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: FROM DEVELOPMENT TO PRODUCTIONfiles.meetup.com/20132567/wp-sviluppo-produzione.pdf · INSTALL WP – BITNAMI Only 1 wordpress per XAMPP Wordpress will be installed in a “wordpress”

FROM DEVELOPMENTTO PRODUCTION

AN EVIL PLAN IN [email protected]

Page 2: FROM DEVELOPMENT TO PRODUCTIONfiles.meetup.com/20132567/wp-sviluppo-produzione.pdf · INSTALL WP – BITNAMI Only 1 wordpress per XAMPP Wordpress will be installed in a “wordpress”

THESE SLIDES

…before lunch didn’t exist

Page 3: FROM DEVELOPMENT TO PRODUCTIONfiles.meetup.com/20132567/wp-sviluppo-produzione.pdf · INSTALL WP – BITNAMI Only 1 wordpress per XAMPP Wordpress will be installed in a “wordpress”

WORDPRESS

Generic requirements:

PHP

MySQL or MariaDB

Apache

Page 4: FROM DEVELOPMENT TO PRODUCTIONfiles.meetup.com/20132567/wp-sviluppo-produzione.pdf · INSTALL WP – BITNAMI Only 1 wordpress per XAMPP Wordpress will be installed in a “wordpress”

XAMPP

www.apachefriends.org

Page 5: FROM DEVELOPMENT TO PRODUCTIONfiles.meetup.com/20132567/wp-sviluppo-produzione.pdf · INSTALL WP – BITNAMI Only 1 wordpress per XAMPP Wordpress will be installed in a “wordpress”

INSTALL XAMPP

Download portable version

Unzip in root (example: D:\xampp)

Run setup_xampp.bat every time you move it

Launch with xampp-control.exe

Note: by default, Skype uses the 80 and 443 portscreating a conflict with Apache,

so you have to disable this Skype feature:

Tools > Options > Advanced > Connection

Page 6: FROM DEVELOPMENT TO PRODUCTIONfiles.meetup.com/20132567/wp-sviluppo-produzione.pdf · INSTALL WP – BITNAMI Only 1 wordpress per XAMPP Wordpress will be installed in a “wordpress”
Page 7: FROM DEVELOPMENT TO PRODUCTIONfiles.meetup.com/20132567/wp-sviluppo-produzione.pdf · INSTALL WP – BITNAMI Only 1 wordpress per XAMPP Wordpress will be installed in a “wordpress”

BROWSER

Dal proprio computer:

http://localhost

http://127.0.0.1

http://192.168.0.14 (esempio)http://miosito.it (se il file host è configurato)

Da altri dispositivi nella stessa rete:

http://192.168.0.14 (esempio)

http://miosito.it (se il file host è configurato)

Per conoscere il proprio IP su Windows,dal prompt dei comandi scrivere: ipconfig

Page 8: FROM DEVELOPMENT TO PRODUCTIONfiles.meetup.com/20132567/wp-sviluppo-produzione.pdf · INSTALL WP – BITNAMI Only 1 wordpress per XAMPP Wordpress will be installed in a “wordpress”

VIRTUAL HOST

D:\xampp\apache\conf\extra\httpd-vhosts.conf

## This code is for one site, but you can have multiple sites,

## just copy, paste and change values

<VirtualHost *:80>

DocumentRoot "D:/xampp/htdocs"

ServerName miosito.it

## windows 403 fix

<Directory />

AllowOverride none

Require all granted

</Directory>

</VirtualHost>

Page 9: FROM DEVELOPMENT TO PRODUCTIONfiles.meetup.com/20132567/wp-sviluppo-produzione.pdf · INSTALL WP – BITNAMI Only 1 wordpress per XAMPP Wordpress will be installed in a “wordpress”

FILE HOST

Windows

Aprire il blocco note come amministratore

Inserire la password di amministratore e fare click su "Consenti"

Aprire il file “hosts” (non ha estensione) localizzato in C:\Windows\System32\drivers\etc\

Aggiungere una riga con indirizzo IP e domini corrispondenti e poi salvare.

127.0.0.1 miosito.it www.miosito.it

Altri sistemi

https://support.serverplan.com/guide/61/0/come-visualizzare-il-sito-prima-del-puntamento-dns

Page 10: FROM DEVELOPMENT TO PRODUCTIONfiles.meetup.com/20132567/wp-sviluppo-produzione.pdf · INSTALL WP – BITNAMI Only 1 wordpress per XAMPP Wordpress will be installed in a “wordpress”

LOCALE 4EVER?

Valutate di sviluppare in produzione se:

• il vostro computer vi chiede un Gatorade

• state scrivendo codice PHP custom

• usate plugin vecchi o con funzioni particolari

• il server è vecchio o ha una configurazione particolare

Page 11: FROM DEVELOPMENT TO PRODUCTIONfiles.meetup.com/20132567/wp-sviluppo-produzione.pdf · INSTALL WP – BITNAMI Only 1 wordpress per XAMPP Wordpress will be installed in a “wordpress”

SVILUPPARE IN PRODUZIONE??

#eresia

Volevo dire: “nel server di” produzione.

Per evitare che il sito sia visibile da chiunque possono essere usati alcuni accorgimenti, come:

• DNS + file host (consigliato)https://support.serverplan.com/guide/61/0/come-visualizzare-il-sito-prima-del-puntamento-dns

• HTTP authentication

• WP plugin “Maintenance” (o simile)https://it.wordpress.org/plugins/maintenance/

Page 12: FROM DEVELOPMENT TO PRODUCTIONfiles.meetup.com/20132567/wp-sviluppo-produzione.pdf · INSTALL WP – BITNAMI Only 1 wordpress per XAMPP Wordpress will be installed in a “wordpress”

INSTALL WP – 1/2Empty the D:\xampp\htdocs\ folder

Download and extract wp in D:\xampp\htdocs\so the wp-config.php file’s path will be

D:\xampp\htdocs\wp-config.php

Create a database from http://localhost/phpmyadmin

Page 13: FROM DEVELOPMENT TO PRODUCTIONfiles.meetup.com/20132567/wp-sviluppo-produzione.pdf · INSTALL WP – BITNAMI Only 1 wordpress per XAMPP Wordpress will be installed in a “wordpress”
Page 14: FROM DEVELOPMENT TO PRODUCTIONfiles.meetup.com/20132567/wp-sviluppo-produzione.pdf · INSTALL WP – BITNAMI Only 1 wordpress per XAMPP Wordpress will be installed in a “wordpress”

INSTALL WP – 2/2

Visit http://localhost /

Follow the white rabbit wizard

Default database username: root

Default database password: none (leave empty!)

Done!

Page 15: FROM DEVELOPMENT TO PRODUCTIONfiles.meetup.com/20132567/wp-sviluppo-produzione.pdf · INSTALL WP – BITNAMI Only 1 wordpress per XAMPP Wordpress will be installed in a “wordpress”

NOTA SUL PATH/

Consiglio di installare wordpress in un sottodominio piuttosto che in una sottocartella, sia

per evitare problemi con i link che per evitare di mischiare le password salvate.

Page 16: FROM DEVELOPMENT TO PRODUCTIONfiles.meetup.com/20132567/wp-sviluppo-produzione.pdf · INSTALL WP – BITNAMI Only 1 wordpress per XAMPP Wordpress will be installed in a “wordpress”

INSTALL WP – BITNAMI

Only 1 wordpress per XAMPP

Wordpress will be installed in a “wordpress” folder and in a “bitnami_wordpress” database.

Run Apache and MySQL services.

Download the installer from https://bitnami.com/stack/xampp

Run it.

Indicate the XAMPP folder.

The “application password” is the default wordpress administrator’s password (username: “user”).

You don’t need “Wordpress in the cloud”.

Launch Bitnami Wordpress module.

Finish!

Page 17: FROM DEVELOPMENT TO PRODUCTIONfiles.meetup.com/20132567/wp-sviluppo-produzione.pdf · INSTALL WP – BITNAMI Only 1 wordpress per XAMPP Wordpress will be installed in a “wordpress”

MOVE WP TO PRODUCTION – 1/2

• Export (aka “backup in a file”, or “create a dump of”) your development database using

PHPMyAdmin (may be painful for large databases, but usually it’s not)

• Import the dump file in an online database using production preinstalled PHPMyAdmin. If you don’t

have access to it, upload it by yourself in a wp-content subfolder, but check the server

requirements before, and remember to delete it after)

• Copy all the files via FTP

Page 18: FROM DEVELOPMENT TO PRODUCTIONfiles.meetup.com/20132567/wp-sviluppo-produzione.pdf · INSTALL WP – BITNAMI Only 1 wordpress per XAMPP Wordpress will be installed in a “wordpress”

MOVE WP TO PRODUCTION – 2/2

If the development url is different from the production url:

• Open wp-config.php file and edit the database credentials (and, if present, the site url)

• Using PHPMyAdmin, find the “wp_options” table and change the option_value of the records with “siteurl” and “home” as their

option_name (DO NOT put a slash after the URL)

• If you get broken links or images in posts’ content, try to run this query from PHPMyAdmin:

UPDATE wp_posts SET guid = REPLACE(guid, "localhost", "www.miosito.it");

• In htaccess, find/replace “localhost” with “www.miosito.it”

• From wp admin, save permalinks

• Disable access restrictions to publish

Page 19: FROM DEVELOPMENT TO PRODUCTIONfiles.meetup.com/20132567/wp-sviluppo-produzione.pdf · INSTALL WP – BITNAMI Only 1 wordpress per XAMPP Wordpress will be installed in a “wordpress”

...OR TRY DUPLICATOR

https://it.wordpress.org/plugins/duplicator/

Great! But:

• result not guarantee (i.e. big websites, particular server configurations)

• needs (temporary) about the double of the disk space, and you find the available space only in

the hosting settings.

Page 20: FROM DEVELOPMENT TO PRODUCTIONfiles.meetup.com/20132567/wp-sviluppo-produzione.pdf · INSTALL WP – BITNAMI Only 1 wordpress per XAMPP Wordpress will be installed in a “wordpress”

THANK YOU

TWITTER: @giorgiobeggiora

GITHUB: giorgiobeggiora

EMAIL: [email protected]