Muestra las diferencias entre dos versiones de la página.
| Próxima revisión | Revisión previa | ||
|
wiki2:install_wordpress [2016/04/16 19:44] alfred creado |
wiki2:install_wordpress [2020/05/09 09:25] (actual) |
||
|---|---|---|---|
| Línea 11: | Línea 11: | ||
| sudo /etc/init.d/apache2 restart | sudo /etc/init.d/apache2 restart | ||
| </code> | </code> | ||
| + | |||
| ==== Allow permalinks ==== | ==== Allow permalinks ==== | ||
| + | <code> | ||
| + | I had to search various sites to solve this problem so I figured I would pass on the knowledge in one succinct solution. | ||
| + | How to get WordPress permalinks / pretty links to work in Ubuntu 10.10 with Apache2: | ||
| + | |||
| + | By the way, this should be the same in Ubuntu 10.04 as well, but I haven't actually tested it there as well. | ||
| + | |||
| + | 1. Manually create a ".htaccess" file and save it in your main WordPress directory. (This is the one with the wp-admin, wp-includes, and wp-content folders.) | ||
| + | |||
| + | 2. Go to the Ubuntu terminal and type: | ||
| + | sudo chown -v :www-data "/enterYourFilePathHere/.htaccess" | ||
| + | You should see a line printed saying that the (group) file ownership has been changed to www-data (Apache2). | ||
| + | |||
| + | 3. Give Apache2 write access to the file: | ||
| + | sudo chmod -v 664 "/enterYourFilePathHere/.htaccess" | ||
| + | You should see a line printed saying that the mode of the file has been retained. | ||
| + | |||
| + | 4. Next, we have to allow WordPress to write to the .htaccess file by enabling mod_write in the Apache2 server. Type the following in the terminal: | ||
| + | sudo a2enmod rewrite | ||
| + | You should see a line printed saying that it is enabling mod rewrite and reminding you to restart the web server | ||
| + | |||
| + | 5. So let's do that. Restart the web server, Apache2, for the changes to take effect by typing: | ||
| + | sudo /etc/init.d/apache2 restart | ||
| + | We are all done with the command line prompt; you can close the command line window now. | ||
| + | |||
| + | 5. Go into your WordPress admin panel (i.e. http://yourDomain/wp-admin). Go to the Settings --> Permalinks and select the permalink format of your choice. Hit the "Save Changes" button. | ||
| + | |||
| + | 6. DONE! Go to your site and check any page (other than your homepage) to ascertain that everything is working as expected. | ||
| + | |||
| + | Hope this helps someone. Leave me a comment below. | ||
| + | </code> | ||
| + | |||
| + | It allows php to change the .htaccess and then the wordpress admin resets it. | ||
| + | |||
| + | If it's not working probably would do when you change the permalink to ''index.php/%postname%/''. But it won't be pretty. So... | ||
| + | |||
| + | You will need to go to ''/etc/apache2/'' and change all the directories to... | ||
| + | <code> | ||
| + | <Directory var/www/> | ||
| + | Options FollowSymLinks | ||
| + | AllowOverride All | ||
| + | </Directory> | ||
| + | </code> | ||
| + | If it is not working, my change are these: | ||
| + | <code> | ||
| + | <Directory /> | ||
| + | Options FollowSymLinks | ||
| + | AllowOverride All | ||
| + | </Directory> | ||
| + | |||
| + | <Directory /usr/share> | ||
| + | AllowOverride None | ||
| + | Require all granted | ||
| + | </Directory> | ||
| + | <Directory /var/www/> | ||
| + | Options FollowSymLinks | ||
| + | AllowOverride All | ||
| + | </Directory> | ||
| + | |||
| + | #<Directory /srv/> | ||
| + | # Options Indexes FollowSymLinks | ||
| + | # AllowOverride None | ||
| + | # Require all granted | ||
| + | #</Directory> | ||
| + | </code> | ||
| + | |||
| + | It's ultra-important to **enable mod rewrite**: ''a2enmod rewrite'' | ||
| ==== Backup and restore ==== | ==== Backup and restore ==== | ||
| Línea 21: | Línea 88: | ||
| - Make and download a backup file. This file must contain files and database. | - Make and download a backup file. This file must contain files and database. | ||
| - Format server | - Format server | ||
| - | - Install apache, php and Mysql | + | - Install apache, php and Mysql. Ensure |
| - Go to ''/var/www/html'' | - Go to ''/var/www/html'' | ||
| - Download with ''wget'' the last Wordpress. | - Download with ''wget'' the last Wordpress. | ||
| - Unzip the wordpress file. | - Unzip the wordpress file. | ||
| - Upload the previous backup file. | - Upload the previous backup file. | ||
| + | - Unzip the backup file. | ||
| + | - Change in the database file (.sql) the beginning adding: the next lines (if database is called blog): | ||
| + | - ''CREATE DATABASE blog;'' | ||
| + | - ''USE blog;'' | ||
| + | - If database has a different password than the previous one you should change ''wp-config.php''. | ||
| + | - Execute the command: ''mysql -u <user> -p < db_backup.dump'' | ||
| + | - Go to ''/var/www'' and execute: | ||
| + | - ''chown -R www-data html'' | ||
| + | - ''chgrp -R www-data html'' | ||
| + | |||
| + | ==== Attacks ==== | ||
| + | |||
| + | It's possible to find in your ''/var/log/apache2/access.log'' a lot of lines like this: ''111.222.333.444:80 555.666.777.888 - - [01/Jan/2016:16:33:50 -0500] "POST /xmlrpc.php HTTP/1.0" 200 674 "-" "Mozilla/4.0 (compatible: MSIE 7.0; Windows NT 6.0)"'' | ||
| + | |||
| + | <code> | ||
| + | <files xmlrpc.php> | ||
| + | order allow,deny | ||
| + | deny from all | ||
| + | </files> | ||
| + | </code> | ||
| + | |||
| + | ==== Problems ==== | ||
| + | |||
| + | Si mueves un site a otra url puedes hacer varias cosas, en el ''wp-config.php''. La mejor opción sea poner el RELOCATE, acceder y el mismo wordpress habrá arreglado las rutas. | ||
| + | <code> | ||
| + | define('RELOCATE',true); | ||
| + | </code> | ||
| + | |||
| + | <code> | ||
| + | define('WP_HOME','https://2017.foropoliamor.org'); | ||
| + | define('WP_SITEURL','https://2017.foropoliamor.org'); | ||
| + | </code> | ||
| + | |||
| + | Para actualizar las urls utiliza: ''Velvet Blues Update URLs plugin'', que se ubicará en herramientas. | ||
| + | |||
| + | ==== Cambiar password desde mysql ==== | ||
| + | <code> | ||
| + | UPDATE `blog_users` SET `user_pass`= MD5('yourpassword') WHERE `user_login`='david'; | ||
| + | </code> | ||
| + | |||