Install and configure Ubuntu Server config for editing, 13.04 our server

After we finished work on the Ubuntu Server installation, 13.04, put the php5-fpm + all necessary modules installed nginx on the server, put the MariaDB + phpMyAdmin, we can start editing configuration files and test runs of different scripts, for example with the information about the current version of php and installed modules. Well let’s get started:
Setting up Ubuntu Server 13.04
To begin with, we need to add a new user to the server, so that in future we can implement all the planned us. To do this, go to the server via SSH as root user, and create a new user by limiting his access to the Schell:
useradd darelvc/home/-m-bU-s/bin/false
Next we need to set a new password for the user we created darelvc:
passwd darelvc
Next, create the required directory for us, in which we are going to work in the future:
I chose this path because the public_html directory is the default catalog for the control panel Cpanel, which I worked for a long time.
Now we need to add a new user to this directory:
chown-R darelvc:/home/darelvc/public_html
Continue to provide access to the directory of nginx:
usermod-a-G www-data darelvc
Now you are ready to create our first configuration file, create it for nginx, it will perform several commands:
touch/etc/nginx/conf.d/ ua. conf
Please note that all newly created configuration files must have the extension. conf, to start here in the main configuration file, this will create a duplicate, just in case:
Open and replace its contents with the new:
user wwwdata;
# As a thumb rule: One per CPU. If you are serving a large amount
# of static files, which requires blocking disk reads, you may want
# to increase this from the number of cpu_cores available on your
# system.
# The maximum number of connections for Nginx is calculated by:
# max_clients = worker_processes * worker_connections
worker_processes 1;
# Maximum file descriptors that can be opened per process
# This should be > worker_connections
worker_rlimit_nofile 8192;
events {
    # When you need > 1000 * cpu_cores connections, you start optimizing
    # your OS, and this is probably the point at where you hire people
    # who are smarter than you, this is *a lot* of requests.
    worker_connections 1000;
error_log /var/log/nginx/error.log;
pid /var/run/;
http {
    charset utf8;
    # Set the mime-types via the mime.types external file
    include mime.types;
    # And the fallback mime-type
    default_type application/octetstream;
    # Click tracking!
    access_log /var/log/nginx/access.log;
    # Upstream to abstract back-end connection(s) for PHP
    upstream php {
    server unix:/tmp/php5fpm.sock;
    # Hide nginx version
    server_tokens off;
    # ~2 seconds is often enough for HTML/CSS, but connections in
    # Nginx are cheap, so generally it’s safe to increase it
    keepalive_timeout 20;
    # You usually want to serve static files with Nginx
    sendfile on;
    tcp_nopush on; # off may be better for Comet/long-poll stuff
    tcp_nodelay off; # on may be better for Comet/long-poll stuff
    server_name_in_redirect off;
    types_hash_max_size 2048;
    gzip on;
    gzip_http_version 1.0;
    gzip_comp_level 5;
    gzip_min_length 512;
    gzip_buffers 4 8k;
    gzip_proxied any;
        # text/html is always compressed by HttpGzipModule
    # This should be turned on if you are going to have pre-compressed copies (.gz) of
    # static files available. If not it should be left off as it will cause extra I/O
    # for the check. It would be better to enable this in a location {} block for
    # a specific directory:
    # gzip_static on;
    gzip_disable “msie6”;
    gzip_vary on;
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sitesenabled/*;
После чего можно отредактировать дефолтный конфигурационный файл nginx :

cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default_old
vim /etc/nginx/sites-available/default
server {
listen 80 default; ## listen for ipv4; this line is default and implied
listen [::]:80 default ipv6only=on; ## listen for ipv6

# Make site accessible from http://localhost/ or server IP-address
server_name localhost;
server_name_in_redirect off;

charset utf-8;

access_log /usr/share/nginx/access.log;
error_log /usr/share/nginx/error.log;

root /usr/share/nginx/www;
index index.php index.html index.htm;

location / {
# First attempt to serve request as file, then
# as directory, then trigger 404
try_files $uri $uri/ =404;

# pass the PHP scripts to FPM socket
location ~ \.php$ {
try_files $uri =404;

fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have “cgi.fix_pathinfo = 0;” in php.ini

fastcgi_pass php;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME /usr/share/nginx/www$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT /usr/share/nginx/www;

# send bad requests to 404
fastcgi_intercept_errors on;

include fastcgi_params;

It’s not the destination data type configuration files, in the future we will add, depending on our requirements.
We can now begin to create our 1 configuration file:
Vim/etc/nginx/conf.d/ ua. conf
It prescribes:
server {
        root /home/darelvc/public_html;
        access_log /home/darelvc/logs/nginx.access.log;
        index index.php index.htm index.html;
        location ~ \.(gif|jpeg|jpg|txt|png|css|js|htm|html|csv|doc|xls|xml|sql|ico)$ {
            access_log        off;
            expires           max;
        location / {
                try_files       $uri $uri/ @rewrite;
        location @rewrite {
                 rewrite         ^/(.*)$ /index.php?q=$1;
        location ~ \.php$ {
                fastcgi_pass unix:/tmp/php5fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include        fastcgi_params;
        location = /favicon.ico {
                log_not_found off;
                access_log off;
        location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
        location ~ /\.ht {
            deny  all;
After work done, be sure to restart nginx and check whether the flecks are errors on reboot:
Service nginx restart
As you can see there are no errors, now we need to configure the Setup for our site under php-fpm, open the file:
And set it to:
listen = /tmp/php5-fpm.sock
listen.mode = 0666
user = darelvc
group = darelvc
php_admin_value[upload_tmp_dir] = /home/darelvc/tmp
php_admin_value[soap.wsdl_cache_dir] = /home/darelvc/tmp
php_admin_value[date.timezone] = Europe/Kiev

pm = static
pm.max_children = 1
pm.max_requests = 250

Then restart our php-fpm
php5-fpm service restart
Now it is time to test our websites php 5.4 on our server, as well as to test launch phpMyAdmin
First head over again in the pool directory (d) and edit the file www.conf
Vim www.conf
Replace the line:
listen =/var/run/php5-fpm.sock
listen =/tmp/php5-fpm.sock
Then create a directory:
It has create our index.php file with this content:
<? php phpinfo ();? >
<? php phpinfo ();? >
We now have when opening the page to display information about PHP. To open the switch at http://IP_сервера/index.php
php version
Ûhuu, everything works just great🙂, now let’s test our phpMyAdmin
sudo ln-s/usr/share/phpmyadmin
In order to test the turn on link:
phpMyAdminKak see also works wonderfully (with 1 start page can be opened for a long time, don’t worry this is normal). Next, let’s try to avtoritizirovat′sâ enter the same data entered during installation of phpMyAdmin
You can also check out phpMyAdminTeper′ your us domain, as he paid php:
<? php phpinfo ();? >
<? php phpinfo ();? >
I’ll check through the hosts file because the domain is not sent to the server, open it and type:
Store and check. All Wonderfully🙂
But in order to more freely navigate the computer, go to the page of the site where you can get acquainted with the conditions of the free classes online cisco courses and other specializations.