Tuto : How to install Yetishare script and Nginx on CentOS7

lajusangat

New Member
YetiShare User
Oct 1, 2012
20
0
1
Hi All,

I try to make tutorial how to install Yetishare script and Nginx on CentOS7.

Step One — Install Nginx
Code:
sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
sudo yum install nginx
sudo systemctl start nginx.service
sudo systemctl enable nginx.service
Step Two — Install MySQL (MariaDB)
Code:
sudo yum install mariadb-server mariadb
sudo systemctl start mariadb
sudo systemctl enable mariadb.service
sudo mysql_secure_installation
The prompt will ask you for your current root password. Since you just installed MySQL, you most likely won’t have one, so leave it blank by pressing enter. Then the prompt will ask you if you want to set a root password. Go ahead and enter Y, and follow the instuctions:
Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

New password: password
Re-enter new password: password
Password updated successfully!
Reloading privilege tables..
... Success!
Create a database and database user :
Code:
mysql -u root -p yourmysqlrootpassword
Code:
CREATE DATABASE demodb;
CREATE USER 'demouser'@'localhost' IDENTIFIED BY 'demopassword';
GRANT ALL PRIVILEGES ON demodb.* to demouser@localhost;
FLUSH PRIVILEGES;
quit
Step Three — Install PHP
Code:
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-2.noarch.rpm
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/l/libmcrypt-2.5.8-13.el7.x86_64.rpm
yum -y install epel-release-7-2.noarch.rpm libmcrypt-2.5.8-13.el7.x86_64.rpm
sudo yum install php php-mysql php-fpm php-gd php-pdo php-mysqli php-mcrypt
Configure the PHP Processor
We now have our PHP components installed, but we need to make a slight configuration change to make our setup more secure.

Open the main php-fpm configuration file with root privileges:
Code:
sudo vi /etc/php.ini
What we are looking for in this file is the parameter that sets cgi.fix_pathinfo. This will be commented out with a semi-colon (;) and set to "1" by default.

This is an extremely insecure setting because it tells PHP to attempt to execute the closest file it can find if a PHP file does not match exactly. This basically would allow users to craft PHP requests in a way that would allow them to execute scripts that they shouldn't be allowed to execute.

We will change both of these conditions by uncommenting the line and setting it to "0" like this:
Code:
cgi.fix_pathinfo=0
Save and close the file when you are finished.

Next, open the php-fpm configuration file www.conf:
Code:
sudo vi /etc/php-fpm.d/www.conf
Find the line that specifies the listen parameter, and change it so it looks like the following:
Code:
listen = /var/run/php-fpm/php-fpm.sock
Then save and quit.

Now, we just need to start our PHP processor by typing:
Code:
sudo systemctl start php-fpm
This will implement the change that we made.

Next, enable php-fpm to start on boot:
Code:
sudo systemctl enable php-fpm.service
Step Four — Configure Nginx to Process PHP Pages
Now, we have all of the required components installed. The only configuration change we still need to do is tell Nginx to use our PHP processor for dynamic content.

We do this on the server block level (server blocks are similar to Apache's virtual hosts). Open the default Nginx server block configuration file by typing:
Code:
sudo vi /etc/nginx/conf.d/default.conf
Paste below code in /etc/nginx/conf.d/default.conf and put your domain name.

Code:
server {
    listen       80;
    server_name  yourdomain.com; # change this for your server
    root /usr/share/nginx/html;
    index index.php;
    client_max_body_size 50G;

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ \.php$ {
        if (!-e $request_filename) { rewrite ^/(.*) /index.php?_page_url=$1 last; }
        fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    location / {
		if (!-e $request_filename) {
			rewrite ^/(.*) /index.php?_page_url=$1 last;
		}
    }

    location /files/ {
        internal;
    }

    # these locations would be hidden by .htaccess normally
    location /core/logs/ {
        deny all;
    }
}
When you've made the above changes, you can save and close the file.

Restart Nginx to make the necessary changes:
Code:
sudo systemctl restart nginx
Step Five - Install Yetishare script
1.Login to yetishare panel,
https://yetishare.com/login.html

2.Download File Hosting Script - v4.0

3.Upload File_Hosting_Script_v4_0.zip to /usr/share/nginx/html/

4.Install unzip
Code:
yum -y install unzip
5.Change file and folder permissions
Code:
cd /usr/share/nginx/html
unzip File_Hosting_Script_v4_0.zip
chmod 0777 files
chmod 0777 plugins
chmod 0777 core/cache
chmod 0777 core/logs
chmod 0777 _config.inc.php
6.The address you want to visit will be:
http://your_domain_address.com/install

Done! :D
 

mobilny4257

New Member
YetiShare User
Sep 15, 2014
13
0
0
Re: Tuto : How to install Yetishare script and Nginx on Cent

great, thanks for share, but I would use webuzo control panel with pre installed lemp server (Linux, Nginx, MySQL , PHP ) which is much simpler and has more features

Code:
wget -N http://files.webuzo.com/install.sh
chmod 0755 install.sh
./install.sh --install=lemp,bind

that's all :D