<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Wordpess on Janik von Rotz</title>
    <link>https://janikvonrotz.ch/tags/wordpess/</link>
    <description>Recent content in Wordpess on Janik von Rotz</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Sat, 22 Mar 2014 10:26:15 +0000</lastBuildDate>
    <atom:link href="https://janikvonrotz.ch/tags/wordpess/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Step by Step: Install WordPress Blog</title>
      <link>https://janikvonrotz.ch/2014/03/22/step-by-step-install-wordpress-blog/</link>
      <pubDate>Sat, 22 Mar 2014 10:26:15 +0000</pubDate>
      <guid>https://janikvonrotz.ch/2014/03/22/step-by-step-install-wordpress-blog/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Latest Version of this guide: &lt;a href=&#34;https://gist.github.com/9320678&#34;&gt;https://gist.github.com/9320678&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Finishing this guide you&amp;rsquo;ll get:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A running WordPress installation&lt;/li&gt;&#xA;&lt;li&gt;Nginx proxy with PHP and Fast CGI&lt;/li&gt;&#xA;&lt;li&gt;MySQL server accessible with phpMyAdmin&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Specification of latest running installation:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Date: 03.03.2014&lt;/li&gt;&#xA;&lt;li&gt;OS: Ubuntu 64 bit - 12.04.4 LTS&lt;/li&gt;&#xA;&lt;li&gt;Provider: Amazon EC2&lt;/li&gt;&#xA;&lt;li&gt;Browser: Google Chrome - 33.0.1750.117&lt;/li&gt;&#xA;&lt;li&gt;WordPress: 3.8.1&lt;/li&gt;&#xA;&lt;li&gt;Nginx: 1.1.19&lt;/li&gt;&#xA;&lt;li&gt;MySQL: 5.5.35&lt;/li&gt;&#xA;&lt;li&gt;PHP: 5.3.10&lt;/li&gt;&#xA;&lt;li&gt;phpMyAdmin: 3.4.10.1&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Requirements&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Server is behind a firewall, that only allows http, https and ssh&lt;/li&gt;&#xA;&lt;li&gt;The server is accessed with ssh keys (user password authentication must be disabled)&lt;/li&gt;&#xA;&lt;li&gt;Server is not accessed with the root user&lt;/li&gt;&#xA;&lt;li&gt;You&amp;rsquo;re able to edit files with &lt;a href=&#34;http://www.cheatography.com/ericg/cheat-sheets/vi-editor/&#34;&gt;VI&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;ubuntu&#34;&gt;Ubuntu&lt;/h2&gt;&#xA;&lt;p&gt;Update Ubuntu&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo apt-get update &amp;amp;&amp;amp; sudo apt-get upgrade&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Install additional packages&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo aptitude install build-essential zip git&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;mysql&#34;&gt;MySQL&lt;/h2&gt;&#xA;&lt;p&gt;Install MySQL server and php5 MySQL module&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo apt-get install mysql-server php5-mysql&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Set the mysql root user password during the installation&lt;/p&gt;&#xA;&lt;p&gt;Install the default MySQL databases&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo mysql_install_db&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Run the finisher script and respond every prompt with yes to get a secure MySQL installation&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo /usr/bin/mysql_secure_installation&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Connect to your new MySQL server&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;mysql -uroot -p&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Enter the root password&lt;/p&gt;&#xA;&lt;p&gt;And run this command to get the MySQL version&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;SHOW variables LIKE &amp;quot;%version%&amp;quot;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;nginx&#34;&gt;Nginx&lt;/h2&gt;&#xA;&lt;p&gt;Install Nginx&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo apt-get install nginx&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Create a Nginx site configuration file&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo touch /etc/nginx/sites-available/wordpress.conf&#xA;sudo vi /etc/nginx/sites-available/wordpress.conf&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Paste this config&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;server {    &#xA;listen   80;&#xA;&#xA;&#x9;root /var/www/wordpress;&#xA;&#x9;index index.php index.html index.htm;&#xA;&#xA;&#x9;server_name [example.com];&#xA;&#xA;&#x9;location / {&#xA;&#x9;&#x9;try_files $uri $uri/ /index.php?q=$uri&amp;amp;$args;&#xA;&#x9;}&#xA;&#xA;&#x9;error_page 404 /404.html;&#xA;&#xA;&#x9;error_page 500 502 503 504 /50x.html;&#xA;&#x9;location = /50x.html {&#xA;&#x9;&#x9;root /usr/share/nginx/www;&#xA;&#x9;}&#xA;    &#xA;    client_max_body_size 10M;&#xA;&#xA;&#x9;# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000&#xA;&#x9;location ~ \.php$ {&#xA;&#x9;&#x9;try_files $uri = 404;&#xA;&#x9;&#x9;#fastcgi_pass 127.0.0.1:9000;&#xA;&#x9;&#x9;# With php5-fpm:&#xA;&#x9;&#x9;fastcgi_pass unix:/var/run/php5-fpm.sock;&#xA;&#x9;&#x9;fastcgi_index index.php;&#xA;&#x9;&#x9;include fastcgi_params;&#xA;&#x9;}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Optionally you can rewrite false urls to a specified canonical url&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;server {&#xA;    listen       80;&#xA;    server_name  www.example.com  example.com;&#xA;    if ($http_host = www.example.org) {&#xA;        rewrite  (.*)  http://[example.com]$1;&#xA;    }&#xA;    ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create a symlink to the config file&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo ln -s /etc/nginx/sites-available/wordpress.conf /etc/nginx/sites-enabled/wordpress.conf&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Restart Ngnix&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo service nginx restart&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Check Nginx version&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;nginx -v&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;php&#34;&gt;PHP&lt;/h2&gt;&#xA;&lt;p&gt;Install PHP with FastCGI support&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo apt-get install php5-fpm&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;configure PHP installaton&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; sudo vi /etc/php5/fpm/php.ini&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Find the line &lt;code&gt;cgi.fix_pathinfo=1&lt;/code&gt; by pressing ESC and enter&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;/;cgi.fix_pathinfo=1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Uncomment this line and change value to 0&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;cgi.fix_pathinfo=0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If this number is kept as 1, the php interpreter will do its best to process the file that is as near to the requested file as possible. This is a possible security risk. If this number is set to 0, conversely, the interpreter will only process the exact file path—a much safer alternative.&lt;/p&gt;&#xA;&lt;p&gt;Find the line &lt;code&gt;; default extension directory.&lt;/code&gt; and insert below&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;extension=mcrypt.so&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Update the listening port for the php fpm&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo vi /etc/php5/fpm/pool.d/www.conf&#xA;Set listen = /var/run/php5-fpm.sock&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Restart the service&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo service php5-fpm restart&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Create the website folder&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo mkdir /var/www/wordpress&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Add a PHP info file&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo vi /var/www/wordpress/info.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Set content&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;lt;?php&#xA;phpinfo();&#xA;?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Open your browser on &lt;a href=&#34;http://example.com/info.php&#34;&gt;http://example.com/info.php&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Delete this file if everything works&lt;/p&gt;&#xA;&lt;h2 id=&#34;phpmyadmin&#34;&gt;phpMyAdmin&lt;/h2&gt;&#xA;&lt;p&gt;Install phpMyAdmin&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo apt-get install phpmyadmin&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When phpMyAdmin prompts you to choose a server (either apache or lighttpd)hit tab, and select neither one.&lt;/p&gt;&#xA;&lt;p&gt;When phpMyAdmin asks you wether to configure database for phpmyadmin with dbconfig-common. Chose &lt;!-- raw HTML omitted --&gt; and enter the MySQL root user password&lt;/p&gt;&#xA;&lt;p&gt;Hit &lt;!-- raw HTML omitted --&gt; on the MySQL application password for phpmyadmin prompt.&lt;/p&gt;&#xA;&lt;p&gt;Create a symbolic link for the phpMyAdmin website&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/www&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Create a Nginx configuration file&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo touch /etc/nginx/sites-available/phpmyadmin.conf&#xA;sudo vi /etc/nginx/sites-available/phpmyadmin.conf&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Paste this config&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;server{&#xA;&#x9;listen 80;&#xA;&#x9;&#xA;&#x9;server_name [Your Public IP];&#xA;&#x9;root /var/www/;&#xA;&#x9;&#xA;&#x9;index index.php index.html index.htm;&#xA;&#x9;&#xA;    client_max_body_size 10M;&#xA;    &#xA;&#x9;location ~ .php$ {&#xA;&#x9;&#x9;try_files $uri = 404;&#xA;&#x9;&#x9;fastcgi_pass unix:/var/run/php5-fpm.sock;&#xA;&#x9;&#x9;fastcgi_index index.php;&#xA;&#x9;&#x9;include /etc/nginx/fastcgi_params;&#xA;&#x9;}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create a symlink to the config file&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo ln -s /etc/nginx/sites-available/phpmyadmin.conf /etc/nginx/sites-enabled/phpmyadmin.conf&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Restart Ngnix&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo service nginx restart&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Open the browser on http://[YourPublicIP]/phpmyadmin/&lt;/p&gt;&#xA;&lt;h2 id=&#34;wordpress&#34;&gt;WordPress&lt;/h2&gt;&#xA;&lt;p&gt;Open the WordPress site directory&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;cd /var/www/wordpress/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Download latest WordPress package and untar it&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo wget http://wordpress.org/latest.tar.gz&#xA;tar -xzvf latest.tar.gz&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Copy the untared files to the current folder and delete the other files&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo cp -r ./wordpress/* ./&#xA;sudo rm -r wordpress&#xA;sudo rm latest.tar.gz&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s create the MySQL WordPress user&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;mysql -u root -p&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Enter the MySQL root user password&lt;/p&gt;&#xA;&lt;p&gt;Create the WordPress database&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;CREATE DATABASE wordpress;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Create the WordPress database user&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;CREATE USER wordpress@localhost;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Set the password for the WordPress database user&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;SET PASSWORD FOR wordpress@localhost = PASSWORD(&amp;quot;[password]&amp;quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Grant WordPress user full access on WordPress database&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;GRANT ALL PRIVILEGES ON wordpress.* TO wordpress@localhost IDENTIFIED BY &#39;[password]&#39;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Refresh MySQL and exit&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;FLUSH PRIVILEGES;&#xA;exit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Copy the WordPress example config file&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo cp wp-config-sample.php wp-config.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Edit the config file&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo vi wp-config.php&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Set database, database user and his password&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;define(&amp;#39;DB_NAME&amp;#39;, &amp;#39;wordpress&amp;#39;);&#xA;&#xA;define(&amp;#39;DB_USER&amp;#39;, &amp;#39;wordpress&amp;#39;);&#xA;&#xA;define(&amp;#39;DB_PASSWORD&amp;#39;, &amp;#39;[password]&amp;#39;);&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Update permissions for Nginx user&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo chown www-data:www-data * -R &#xA;sudo usermod -a -G www-data www-data&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Open the browser on &lt;a href=&#34;http://example.com&#34;&gt;http://example.com&lt;/a&gt; and install you WordPress blog&lt;/p&gt;&#xA;&lt;h2 id=&#34;source&#34;&gt;Source&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://dev.mysql.com/doc/refman/5.7/en/linux-installation-native.html&#34;&gt;Install MySQL&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&#34;https://www.digitalocean.com/community/articles/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-12-04&#34;&gt;How To Install Linux, nginx, MySQL, PHP (LEMP) stack on Ubuntu 12.04 by Digital Ocean&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&#34;https://www.digitalocean.com/community/articles/how-to-install-phpmyadmin-on-a-lemp-server/&#34;&gt;How To Install phpMyAdmin on a LEMP server by Digi&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&#34;https://www.digitalocean.com/community/articles/how-to-install-wordpress-with-nginx-on-ubuntu-12-04&#34;&gt;How To Install Wordpress with nginx on Ubuntu 12.04 by Digital Ocean&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&#34;http://nginx.org/en/docs/http/converting_rewrite_rules.html&#34;&gt;Nginx rewrite rules&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&#34;https://dev.mysql.com/doc/refman/5.0/en/installation-version.html&#34;&gt;Get MySQL version&lt;/a&gt;&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
