User Tools

Site Tools


installation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
installation [2017/04/07 08:31] admininstallation [2026/03/21 10:11] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== Installation ====== ====== Installation ======
  
-  You'll need Mysql DB and SSH access to your server +Install the script with a single shell commandNavigate to your domain and run:
-   +
-  +
-Now it really easy to install the script. You don't even have to download an install file, just run the following command in SSH+
  
 +<code>
 +curl -sS http://smartcj.com/updates2/install | php --
 +</code>
 +
 +The script will install in interactive mode.
 +Note: The two dashes at the end are required.
 +
 +Alternatively, specify all parameters on the command line:
  
 <code> <code>
-curl -sS http://smartcj.com/updates2/install | php -- +curl -sS http://smartcj.com/updates2/install | php -- mysql_host= mysql_user= mysql_pass= mysql_name= scj_folder= domain= admin_email=
 </code> </code>
  
-and the script will be installed in few seconds 
  
-PS yes those two dashes are obligatory +By defaultthe script only writes to its own directory. You need to copy index.php from scj/cgi to your site root.
  
-Also there are optional parameter + 
 +If you're using SmartCJ rotation, enter the full PATH (not URL) to scj/tube/index.php in Settings - CJ Pages. For example: /home/user/domain.com/scj/tube/index.php 
 + 
 +  
 + 
 +====== Server Requirements ====== 
 + 
 +To install SmartCJ, you'll need: 
 + 
 +  - Any version of *NIX 
 +  - SSH access 
 +  - MySQL DB 5.7+ (database name, login, and password are up to you) 
 +  - PHP 7+ 
 +  - IonCube (free PHP plugin for performance) 
 + 
 + 
 +===== Default Rewrites ===== 
 + 
 +Here are the default rewrite rules. See [[New Rotation Faq]] for more details. 
 + 
 +<code>  
 +RewriteEngine On 
 + 
 +RewriteBase / 
 +RewriteCond %{REQUEST_FILENAME} !-f 
 +RewriteCond %{REQUEST_FILENAME} !-d 
 +RewriteRule ^([^/]{2})/(.*)$ $2?force_lng=$1&%{QUERY_STRING} [L] 
 + 
 + 
 +# add &dont_count_in_trade=true if you dont want to count these clicks 
 +RewriteRule ^category/([^/]+)/$ /script_folder_name/cgi/out.php?url=content&p=100&skip_sell=true&group_name=$1&order=ctr&%{QUERY_STRING} [L] 
 +RewriteRule ^category/([^/]+)/([^/]+)/([^/]+)/$ /script_folder_name/cgi/out.php?url=content&p=100&skip_sell=true&group_name=$1&order=$2&page=$3&%{QUERY_STRING} [L] 
 + 
 +#slug galleries 
 +RewriteRule ^gallery/([^/]+)/index.html$ /script_folder_name/cgi/out.php?url=content&slug=$1&%{QUERY_STRING} [L] 
 +RewriteRule ^gallery/([^/]+)/([0-9]{1,2}).html$ /script_folder_name/cgi/out.php?url=content&slug=$1&item_id=$2&%{QUERY_STRING} [L] 
 + 
 +#tags 
 +RewriteRule ^tag/([^/]+)/([^/]+)/([^/]+)/$ /script_folder_name/tube/index.php?tag=$1&page=$3&order=$2&%{QUERY_STRING} [L] 
 +RewriteRule ^tag/([^/]+)/([^/]+)/$ /script_folder_name/tube/index.php?tag=$1&page=$2&%{QUERY_STRING} [L] 
 +RewriteRule ^tag/([^/]+)/$ /script_folder_name/tube/index.php?tag=$1&%{QUERY_STRING} [L] 
 + 
 +#model galleries 
 +RewriteRule ^model_galleries/([^/]+)/$ /script_folder_name/tube/?model_slug=$1&force_template=model_galleries [L] 
 +RewriteRule ^model_galleries/([^/]+)/([^/]+)/$ /script_folder_name/tube/?model_slug=$1&page=$2&force_template=model_galleries [L] 
 + 
 +RewriteRule ^model/([^/]+)/$ /script_folder_name/tube/?model_slug=$1&force_template=model_galleries&%{QUERY_STRING} [L] 
 +RewriteRule ^model/([^/]+)/([^/]+)/([^/]+)/$ /script_folder_name/tube/?model_slug=$1&force_template=model_galleries&order=$2&page=$3&%{QUERY_STRING} [L] 
 + 
 +RewriteRule ^search/([^/]+)/([^/]+)/$ /script_folder_name/tube/index.php?search=$1&page=$2&%{QUERY_STRING} 
 +RewriteRule ^search/([^/]+)/([^/]+)/([^/]+)/$ /script_folder_name/tube/index.php?search=$1&order=$2&page=$3&%{QUERY_STRING} 
 + 
 +RewriteRule ^report/([^/]+)/$ /script_folder_name/tube/index.php?gallery_id=$1&force_template=content_report&%{QUERY_STRING} 
 + 
 + 
 +</code>  
 + 
 + 
 +For nginx 
 + 
 +<code>  
 + 
 +server { 
 +         
 +        .... 
 +         
 +         
 +         
 + location /script_folder_name/scj2.lic { 
 +     return 404; 
 +
 + 
 + location / { 
 + 
 +                ..... 
 + 
 + if (!-e $request_filename) {  
 +     rewrite "^/([^/]{2})/(.*)$" /$2?force_lng=$1&$query_string ;  
 + }  
 + 
 +
 + 
 + location /gallery { 
 +     rewrite ^/gallery/([^/]+)/index.html$ /script_folder_name/cgi/out.php?url=content&slug=$1&$query_string ; 
 +     rewrite "^/gallery/([^/]+)/([0-9]{1,2}).html$" /script_folder_name/cgi/out.php?url=content&slug=$1&item_id=$2&$query_string ; 
 +
 + 
 + location /category {  
 +     rewrite ^/category/([^/]+)/$ /script_folder_name/cgi/out.php?url=content&p=100&dont_count_in_trade=true&skip_sell=true&group_name=$1&order=ctr&$query_string ;  
 +     rewrite ^/category/([^/]+)/([^/]+)/([^/]+)/$ /script_folder_name/cgi/out.php?url=content&p=100&dont_count_in_trade=true&skip_sell=true&group_name=$1&order=$2&page=$3&$query_string ;  
 + }  
 + 
 + location /tag {  
 + rewrite ^/tag/([^/]+)/([^/]+)/([^/]+)/$ /script_folder_name/tube/index.php?tag=$1&page=$3&order=$2&$query_string ;  
 + rewrite ^/tag/([^/]+)/([^/]+)/$ /script_folder_name/tube/index.php?tag=$1&page=$2&$query_string ;  
 + rewrite ^/tag/([^/]+)/$ /script_folder_name/tube/index.php?tag=$1&$query_string ;  
 +
 + 
 + 
 + location /model_galleries {  
 + rewrite ^/model_galleries/([^/]+)/$ /script_folder_name/tube/?model_slug=$1&force_template=model_galleries ;  
 + rewrite ^/model_galleries/([^/]+)/([^/]+)/$ /script_folder_name/tube/?model_slug=$1&page=$2&force_template=model_galleries ;  
 + }  
 +  
 + location /model {  
 + rewrite ^/model/([^/]+)/$ /script_folder_name/tube/?model_slug=$1&force_template=model_galleries&$query_string ;  
 + rewrite ^/model/([^/]+)/([^/]+)/([^/]+)/$ /script_folder_name/tube/?model_slug=$1&force_template=model_galleries&order=$2&page=$3&$query_string ;  
 + }  
 +  
 + location /search {  
 + rewrite ^/search/([^/]+)/([^/]+)/$ /script_folder_name/tube/index.php?search=$1&page=$2&$query_string;  
 + rewrite ^/search/([^/]+)/([^/]+)/([^/]+)/$ /script_folder_name/tube/index.php?search=$1&order=$2&page=$3&$query_string;  
 +
 + 
 + 
 +</code>  
 + 
 + 
 + 
 + 
 +===== Sphinx Config ===== 
 + 
 +In Sphinx Settings, use 127.0.0.1 in 99% of cases. 
 + 
 +Here's an example config (you can view the current config directly in your script settings, Sphinx tab):
  
 <code> <code>
-curl -sS http://smartcj.com/updates2/install | php -- mysql_hostmysql_usermysql_passmysql_namescj_folderdomainadmin_email=+ 
 +Modify the searchd section: 
 + 
 +searchd 
 +
 + listen      = your_port:mysql41 
 + 
 +The key here is adding mysql41, which enables Sphinx to listen using the MySQL protocol. 
 + 
 +Next, here's an example for the database: 
 + 
 +source your_name_source 
 +
 + type mysql 
 + 
 + sql_host localhost 
 + sql_user = 
 + sql_pass = 
 + sql_db = 
 + sql_port 3306 # optional, default is 3306 
 + 
 + sql_query_pre SET NAMES utf8 
 + 
 + sql_query = SELECT gi.gallery_id, UNIX_TIMESTAMP(gi.activation_date) as date, alt, description, gi.duration, sponsor_id, gs.total_ctr, gi.content_type,
 + (SELECT group_concat(tag_name) FROM rot_gal2tag g2t \ 
 + LEFT JOIN rot_tags as t on t.tag_id = g2t.tag_id \ 
 + WHERE g2t.gallery_id = gi.gallery_id) as tags, \ 
 + (SELECT group_concat(tag_id) FROM rot_gal2tag g2t \ 
 + WHERE g2t.gallery_id = gi.gallery_id) as tag_ids, \ 
 + (SELECT group_concat(name) FROM rot_groups 
 + WHERE rot_groups.id in (SELECT group_id FROM rot_gallery_stats1 WHERE rot_gallery_stats1.gallery_id = gi.gallery_id AND group_id != 0) ) as group_names,
 +                                                                  \ 
 + (SELECT group_concat(name) FROM rot_groups 
 + WHERE rot_groups.id in (SELECT group_id FROM rot_gallery_stats1 WHERE rot_gallery_stats1.gallery_id = gi.gallery_id AND group_id != 0) ) as group_names,
 + 
 + (SELECT group_concat(gss.group_id) FROM rot_gallery_stats1 as gss \ 
 + WHERE gss.gallery_id = gi.gallery_id AND group_id != 0) as categories \ 
 + FROM rot_gallery_info AS gi \ 
 + JOIN rot_gallery_data1 AS gd ON gi.gallery_id = gd.gallery_id \ 
 + JOIN rot_gallery_stats1 AS gs ON gs.gallery_id = gi.gallery_id \ 
 + WHERE gallery_status = 'active' and gallery_type = 0 \ 
 + and gs.best_thumb = 'yes' and gs.group_id = 0 AND gs.group_id NOT IN (SELECT group_id FROM rot_groups_data WHERE status != 1) 
 + 
 + 
 + sql_attr_timestamp = date 
 + sql_attr_uint     = duration 
 + sql_attr_uint     = sponsor_id 
 + sql_attr_float     = total_ctr 
 + sql_attr_uint     = content_type 
 +    sql_attr_multi = uint categories from field;  
 +    sql_attr_multi = uint tag_ids from field;  
 + 
 +
 + 
 + 
 +index your_name_index 
 +
 + source = your_name_source 
 + path = /your_path 
 + docinfo = extern 
 + morphology              = stem_en 
 + charset_type = utf-8 
 + 
 +
 </code> </code>
  
-   
  
  
  
  
installation.1491553917.txt.gz · Last modified: (external edit)