Create a blog

Today I start creating my blog. Why? To share my experience I learned a lot from the blogs of other Internet users, it’s my turn to share a bit.

I have, moreover, the annoying mania to start many projects but, once the interesting part solved, leave them in a drawers. Writing an article will force me to finish the project and document it.

Nothing more simple, go to the site of the most popular frameworks for this kind of site: WordPress ; then I install the source files on one of my servers. The procedure I followed is summarized below.

  • My server : A Debian Linux server with already installed packages Nginx, php 7, Mysql : a LNMP(1) server 🙂
  • I “unzip” and “untar” source files in /var/www/blog :
    gzip -d wordpress.tar.gz
    tar -xvf wordpress.tar
    mv wordpress blog
  • I change owner of files
    chown -R www-data:www-data /var/www/blog
  • I create the configuration file /etc/nginx/dite-available/blog like this (to adapt):
    # Blog site
    server {
      listen       80;
      server_name blog.MY_DOMAINE;
      rewrite ^ https://$http_host$request_uri? permanent;    # force redirect http to https
    server {
      listen 443 ssl;
      server_name MY_DOMAINE;
      root /var/www/blog;
      index index.php index.html;
      ssl_certificate     /etc/nginx/ssl/mydomain.crt;
      ssl_certificate_key /etc/nginx/ssl/mydomain.key;
      location ~ /\.ht {
        deny all;
      location ~ \.php {
        try_files $uri =404;
        fastcgi_index index.php;
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        include /etc/nginx/fastcgi_params;
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  • I enable virtual host and restart Nginx
    ln -s /etc/nginx/site-available/blog /etc/nginx/site-enable/blog
    /etc/init.d/nginx restart
  • I create a database and dedicated user into MySQL
    GRANT ALL PRIVILEGES ON blog.* TO "blog"@"localhost" IDENTIFIED BY 'my_password';

It only remains to train at WorlPress. For this there are many tutorials on the subject. Then you have to practice, it’s quite intuitive. You are reading my first article 🙂

(1) : This acronym does not exist, it is a wink in reference to WAMP and LAMP servers (for Windows or Linux+Apache+MyQSL+Php). Here it would be Linux+Nginx+MySQL+Php.

Related Posts