Project

General

Profile

Support #867

Updated by Daniel Curtis about 8 years ago

{{>toc}} 

 This is a guide on setting up SEO-Panel with Nginx on FreeBSD 10. 

 *NOTE*: For some reason, SEO-Panel will run properly with nginx and php-fpm. 

 h1. Prepare the Environment 

 * Before installation of the components, make sure everything is up to date using the following command: 
 <pre> 
 pkg update -f && pkg upgrade 
 </pre> 

 * Install the dependencies: 
 <pre> 
 pkg install git 
 </pre> 

 * Create the seopanel user: 
 <pre> 
 pw user add -n seopanel -s /sbin/nologin -c "SEO Panel" 
 </pre> 

 --- 

 h1. Install MySQL Server 

 * Start by installing the mariadb100-server and mariadb100-client packages: 
 <pre> 
 pkg install mariadb100-{server,client} 
 </pre> 

 * Copy a base MySQL configuration to use: 
 <pre> 
 cp /usr/local/share/mysql/my-small.cnf /var/db/mysql/my.cnf 
 </pre> 

 * Enable and start mysql at boot: 
 <pre> 
 echo 'mysql_enable="YES"' >> /etc/rc.conf 
 service mysql-server start 
 </pre> 

 * Prepare the database for use by running the secure installation: 
 <pre> 
 mysql_secure_installation 
 </pre> 
 #* *NOTE*: +Choose a strong root password+ and answer +yes+ to all questions. 

 h2. Create Databases and Users 

 * Login to MySQL and create appropriate databases and users. 
 <pre> 
 mysql -u root -p 
 </pre> 
 #* and run the following SQL queries to create the *seopaneldb* database and *seopaneluser* user: 
 <pre> 
 CREATE DATABASE seopaneldb CHARACTER SET utf8; 

 CREATE USER 'seopaneluser'@'localhost' IDENTIFIED BY 'SuperSecretPassword'; 

 GRANT ALL PRIVILEGES ON seopaneldb.* TO 'seopaneluser'@'localhost'; 

 FLUSH PRIVILEGES; 

 quit 
 </pre> 

 --- 

 h1. Install Nginx 

 * Install Nginx 
 <pre> 
 pkg install nginx 
 </pre> 

 * Start and enable nginx at boot: 
 <pre> 
 echo 'nginx_enable="YES"' >> /etc/rc.conf 
 service nginx start 
 </pre> 

 * Create a configuration directory to make managing individual server blocks easier 
 <pre> 
 mkdir /usr/local/etc/nginx/conf.d 
 </pre> 

 * Edit the main nginx config file: 
 <pre> 
 vi /usr/local/etc/nginx/nginx.conf 
 </pre> 
 #* And strip down the config file and add the include statement at the end to make it easier to handle various server blocks: 
 <pre> 
 load_module /usr/local/libexec/nginx/ngx_mail_module.so; 
 load_module /usr/local/libexec/nginx/ngx_stream_module.so; 

 worker_processes    1; 
 error_log    /var/log/nginx-error.log; 

 events { 
     worker_connections    1024; 
 } 

 http { 
     include         mime.types; 
     default_type    application/octet-stream; 
     sendfile          on; 
     keepalive_timeout    65; 

     # Load config files from the /etc/nginx/conf.d directory 
     include /usr/local/etc/nginx/conf.d/*.conf; 
 } 
 </pre> 

 --- 

 h1. Install PHP 

 * Install PHP 5.6 and a few extensions: 
 <pre> 
 pkg install php56 php56-{curl,gd,mysqli,pdo_mysql,session} 
 </pre> 

 * Configure the default PHP settings 
 <pre> 
 cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini 
 </pre> 

 * Edit the php config file: 
 <pre> 
 vi /usr/local/etc/php.ini 
 </pre> 
 #* And make sure the following values are set: 
 <pre> 
 date.timezone = "America/Los_Angeles" 
 short_open_tag = On 
 </pre> 

 * Create a directory for the php-fpm configs: 
 <pre> 
 mkdir /usr/local/etc/php-fpm.d 
 </pre> 

 * Edit the php-fpm config file: 
 <pre> 
 vi /usr/local/etc/php-fpm.conf 
 </pre> 
 #* Make the following changes: 
 <pre> 
 include=/usr/local/etc/php-fpm.d/*.conf 
 </pre> 

 * Enable PHP-FPM at boot: 
 <pre> 
 echo 'php_fpm_enable="YES"' >> /etc/rc.conf 
 </pre> 

 * Restart nginx: 
 <pre> 
 service nginx restart 
 </pre> 

 --- 

 h1. h2. Install SEO-Panel 

 * Download the lastest version of SEO-Panel from GitHub: 
 <pre> 
 cd /usr/local/www 
 git clone https://github.com/sendtogeo/Seo-Panel.git 
 </pre> 

 * Create an *seopanel.example.com server block* config file: 
 <pre> 
 vi /usr/local/etc/nginx/conf.d/seopanel.example.com.conf 
 </pre> 
 #* Add the following: 
 <pre> 
 upstream seopanel-handler { 
   server unix:/var/run/seopanel.example.com-php-fpm.sock; 
 } 

 server { 
   listen 80; 
   server_name seopanel.example.com; 
   root /usr/local/www/Seo-Panel; 
   index index.html index.php; 

   # Set size for max uploaded content 
   client_max_body_size 0; 
   client_header_timeout 30m; 
   client_body_timeout 30m; 

   location = /robots.txt { 
     allow all; 
     log_not_found off; 
     access_log off; 
   } 

   location ~ ^/(?:CHANGELOG\.md|config|README.md|.git){ 
     deny all; 
   } 

   location / { 
     try_files $uri $uri/ =404; 
   } 

   location ~ \.php(?:$|/) { 
     fastcgi_split_path_info ^(.+\.php)(/.+)$; 
     fastcgi_index index.php; 
     include fastcgi_params; 
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
     fastcgi_param PATH_INFO $fastcgi_path_info; 
     fastcgi_pass seopanel-handler; 
     fastcgi_intercept_errors on; 
   } 
 } 
 </pre> 

 * Create the seopanel php-fpm pool config file: 
 <pre> 
 vi /usr/local/etc/php-fpm.d/seopanel.example.com.conf 
 </pre> 
 #* And add the following: 
 <pre> 
 [seopanel.example.com] 
 user = seopanel 
 group = www 
 listen = /var/run/seopanel.example.com-php-fpm.sock 
 listen.owner = seopanel 
 listen.group = www 
 pm = dynamic 
 pm.max_children = 5 
 pm.start_servers = 2 
 pm.min_spare_servers = 1 
 pm.max_spare_servers = 3 
 </pre> 

 * Change the ownership of the seopanel directory: 
 <pre> 
 chown -R seopanel:www /usr/local/www/Seo-Panel 
 </pre> 

 * Restart nginx and start php-fpm: 
 <pre> 
 service nginx restart 
 service php-fpm start 
 </pre> 

 * Now open up a web browser and go to http://seopanel.example.com/install to finish the setup process. 
 *NOTE*: Default username is *spadmin*; default password is *spadmin* 

 * Secure the installation: 
 <pre> 
 rm -rf /usr/local/www/Seo-Panel/install 
 chmod -w /usr/local/www/Seo-Panel/config/sp-config.php 
 </pre> 

 h1. h2. Resources 

 * http://www.seopanel.in/install/ 
 * http://www.seopanel.in/install/requirements/ 
 * https://github.com/sendtogeo/Seo-Panel

Back