Joomla,PHP,Nginx,PostgreSQL,fpmonCentOS6.4×64

德哥發表於2016-03-28
本文介紹一下Joomla的安裝和配置.

環境 : 
CentOS 
6.x x64

PHP

# rpm -qa|grep php
php-pdo-5.4.30-1.el6.remi.x86_64
php-gd-5.4.30-1.el6.remi.x86_64
php-fpm-5.4.30-1.el6.remi.x86_64
php-common-5.4.30-1.el6.remi.x86_64
php-5.4.30-1.el6.remi.x86_64
php-extras-debuginfo-5.3.3-3.el6.x86_64
php-cli-5.4.30-1.el6.remi.x86_64
php-intl-5.4.30-1.el6.remi.x86_64
php-xml-5.4.30-1.el6.remi.x86_64
php-pgsql-5.4.30-1.el6.remi.x86_64
php-mbstring-5.4.30-1.el6.remi.x86_64

Nginx

# rpm -qa|grep nginx
nginx-1.6.0-1.el6.ngx.x86_64
nginx-release-centos-6-0.el6.ngx.noarch

PostgreSQL

> psql -V
psql (PostgreSQL) 9.3.3

Joomla

3.3.1


安裝和配置步驟 : 
1. php配置

[root@db-172-16-3-150 ~]# cat /etc/php.ini|grep -v "^;"|grep -v "^$"
[PHP]
engine = On
short_open_tag = Off
asp_tags = Off
precision = 14
output_buffering = Off
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 17
disable_functions =
disable_classes =
zend.enable_gc = On
zend.multibyte = On
zend.script_encoding = UTF8
expose_php = Off
max_execution_time = 3000
max_input_time = 60
memory_limit = 128M
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
html_errors = On
variables_order = "GPCS"
request_order = "GP"
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 8M
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
doc_root =
user_dir =
enable_dl = Off
file_uploads = On
upload_max_filesize = 2M
max_file_uploads = 20
allow_url_fopen = Off
allow_url_include = Off
default_socket_timeout = 60
[CLI Server]
cli_server.color = On
[Date]
[filter]
[iconv]
[intl]
[sqlite]
[sqlite3]
[Pcre]
[Pdo]
[Pdo_mysql]
pdo_mysql.cache_size = 2000
pdo_mysql.default_socket=
[Phar]
[mail function]
SMTP = localhost
smtp_port = 25
sendmail_path = /usr/sbin/sendmail -t -i
mail.add_x_header = On
[SQL]
sql.safe_mode = Off
[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[Interbase]
ibase.allow_persistent = 1
ibase.max_persistent = -1
ibase.max_links = -1
ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
ibase.dateformat = "%Y-%m-%d"
ibase.timeformat = "%H:%M:%S"
[MySQL]
mysql.allow_local_infile = On
mysql.allow_persistent = On
mysql.cache_size = 2000
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off
[MySQLi]
mysqli.max_persistent = -1
mysqli.allow_persistent = On
mysqli.max_links = -1
mysqli.cache_size = 2000
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off
[mysqlnd]
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = Off
[OCI8]
[PostgreSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0
[Sybase-CT]
sybct.allow_persistent = On
sybct.max_persistent = -1
sybct.max_links = -1
sybct.min_server_severity = 10
sybct.min_client_severity = 10
[bcmath]
bcmath.scale = 0
[browscap]
[Session]
session.save_handler = files
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.referer_check =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
[MSSQL]
mssql.allow_persistent = On
mssql.max_persistent = -1
mssql.max_links = -1
mssql.min_error_severity = 10
mssql.min_message_severity = 10
mssql.compatability_mode = Off
mssql.secure_connection = Off
[Assertion]
[mbstring]
[gd]
[exif]
[Tidy]
tidy.clean_output = Off
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_limit = 5
[sysvshm]
[ldap]
ldap.max_links = -1
[mcrypt]
[dba]
[curl]
service php-fpm restart

2. nginx配置

# cat /etc/nginx/conf.d/default.conf
server {
        server_name digoal;
        root /opt/site/joomla;    ## <-- Your only path reference.
 
        # Enable compression, this will help if you have for instance advagg? module
        # by serving Gzip versions of the files.
        gzip_static on;
 
        location = /favicon.ico {
                log_not_found off;
                access_log off;
        }
 
        location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
        }
 
        # This matters if you use drush prior to 5.x
        # After 5.x backups are stored outside the Drupal install.
        #location = /backup {
        #        deny all;
        #}
 
        # Very rarely should these ever be accessed outside of your lan
        location ~* .(txt|log)$ {
                allow 172.16.0.0/16;
                deny all;
        }
 
        location ~ ..*/.*.php$ {
                return 403;
        }
 
        # No no for private
        location ~ ^/sites/.*/private/ {
                return 403;
        }
 
        # Block access to "hidden" files and directories whose names begin with a
        # period. This includes directories used by version control systems such
        # as Subversion or Git to store control files.
        location ~ (^|/). {
                return 403;
        }
 
        location / {
                # This is cool because no php is touched for static content
                try_files $uri @rewrite;
        }
 
        location @rewrite {
                # You have 2 options here
                # For D7 and above:
                # Clean URLs are handled in drupal_environment_initialize().
                rewrite ^ /index.php;
                # For Drupal 6 and bwlow:
                # Some modules enforce no slash (/) at the end of the URL
                # Else this rewrite block wouldn`t be needed (GlobalRedirect)
                #rewrite ^/(.*)$ /index.php?q=$1;
        }
 
        location ~ .php$ {
                root /opt/site/joomla;
                include /etc/nginx/fastcgi_params;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        }
 
        # Fighting with Styles? This little gem is amazing.
        # This is for D6
        #location ~ ^/sites/.*/files/imagecache/ {
        # This is for D7 and D8
        location ~ ^/sites/.*/files/styles/ {
                try_files $uri @rewrite;
        }
 
        location ~* .(js|css|png|jpg|jpeg|gif|ico)$ {
                expires max;
                log_not_found off;
        }
}
service nginx restart

3. PostgreSQL配置
因為Joomla install配置過程中沒有配置資料庫連線埠的地方, 所以就用預設的5432吧, 或者直接修改configuration.php的連線引數.

$ psql
psql (9.3.3)
Type "help" for help.
digoal=# show port;
 port 
------
 5432
(1 row)

joomla/libraries/joomla/database/driver/pdo.php
                        case `pgsql`:
                                $this->options[`port`] = (isset($this->options[`port`])) ? $this->options[`port`] : 5432;

                                $format = `pgsql:host=#HOST#;port=#PORT#;dbname=#DBNAME#`;

                                $replace = array(`#HOST#`, `#PORT#`, `#DBNAME#`);
                                $with = array($this->options[`host`], $this->options[`port`], $this->options[`database`]);

                                break;

建立資料庫 : 

pg93@db-172-16-3-150-> cd /ssd4/pg93/
pg93@db-172-16-3-150-> ll
total 12K
drwx------ 16 pg93 pg93 4.0K Jun 28 11:54 pg_root
drwx------  3 pg93 pg93 4.0K Jul 11 15:57 tbs_drupal
drwx------  3 pg93 pg93 4.0K Jun 17 11:53 tbs_test
pg93@db-172-16-3-150-> mkdir tbs_joomla3
pg93@db-172-16-3-150-> psql
psql (9.3.3)
Type "help" for help.

digoal=# create tablespace tbs_joomla3 location `/ssd4/pg93/tbs_joomla3`;
CREATE TABLESPACE
digoal=# create database joomla3 with template template0 encoding `UTF8` tablespace tbs_joomla3 owner joomla; -- owner 給joomla, 因為初始指令碼需要.
CREATE DATABASE
digoal=# create role joomla nosuperuser login encrypted password `joomla321`;
CREATE ROLE
digoal=# grant all on tablespace tbs_joomla3 to joomla;
GRANT
digoal=# c joomla3 joomla
You are now connected to database "joomla3" as user "joomla".
joomla3=> create schema joomla;
CREATE SCHEMA

4. joomla安裝和配置, 

# mkdir joomla
# cd joomla
# wget http://joomlacode.org/gf/download/frsrelease/19524/159413/Joomla_3.3.1-Stable-Full_Package.zip
# unzip Joomla_3.3.1-Stable-Full_Package.zip
# rm -f Joomla_3.3.1-Stable-Full_Package.zip
# cd ..
# mv joomla /opt/site/
# chown -R nginx:nginx /opt/site/joomla

開啟IE, 輸入站點IP或域名. 開啟配置joomla 3.3.1.

Joomla, PHP, Nginx, PostgreSQL, fpm on CentOS 6.4 x64 - 德哥@Digoal - PostgreSQL research
配置資料庫連線, 注意這裡沒有配置埠的地方, 太坑爹了.
Joomla, PHP, Nginx, PostgreSQL, fpm on CentOS 6.4 x64 - 德哥@Digoal - PostgreSQL research

配置ftp, 一般情況下可以無需配置, 全部選否.

Joomla, PHP, Nginx, PostgreSQL, fpm on CentOS 6.4 x64 - 德哥@Digoal - PostgreSQL research

概況, 注意選擇最後一個, 可以按照很多模板, 便於學習joomla的使用.

Joomla, PHP, Nginx, PostgreSQL, fpm on CentOS 6.4 x64 - 德哥@Digoal - PostgreSQL research

資料表的字首, 和schema無關, 這點和drupal差不多的意思, 防止表名衝突, 如果你有多個庫的話, joomla獨立一個庫, 不會和以前的表衝突. 所以可以無需字首.

Joomla, PHP, Nginx, PostgreSQL, fpm on CentOS 6.4 x64 - 德哥@Digoal - PostgreSQL research

可寫項. 如果你選擇了英文配置的話, 會告訴你configuration.php檔案沒有可寫許可權, 其實無所謂, 因為可以在配置完後, 將這個檔案拷貝到joomla的根下面即可.

Joomla, PHP, Nginx, PostgreSQL, fpm on CentOS 6.4 x64 - 德哥@Digoal - PostgreSQL research

 

Joomla, PHP, Nginx, PostgreSQL, fpm on CentOS 6.4 x64 - 德哥@Digoal - PostgreSQL research

 

Joomla, PHP, Nginx, PostgreSQL, fpm on CentOS 6.4 x64 - 德哥@Digoal - PostgreSQL research

 

Joomla, PHP, Nginx, PostgreSQL, fpm on CentOS 6.4 x64 - 德哥@Digoal - PostgreSQL research

安裝過程, 會卡在這個地方, 原因比較多.

Joomla, PHP, Nginx, PostgreSQL, fpm on CentOS 6.4 x64 - 德哥@Digoal - PostgreSQL research
我這裡跟蹤到的卡在這裡的原因.
Joomla, PHP, Nginx, PostgreSQL, fpm on CentOS 6.4 x64 - 德哥@Digoal - PostgreSQL research
表已經建立了, 和資料庫沒關係.

joomla3=> df
                         List of functions
 Schema |  Name   | Result data type | Argument data types |  Type  
--------+---------+------------------+---------------------+--------
 joomla | soundex | text             | input text          | normal
(1 row)

joomla3=> dt
                  List of relations
 Schema |            Name            | Type  | Owner  
--------+----------------------------+-------+--------
 joomla | dg_assets                  | table | joomla
 joomla | dg_associations            | table | joomla
 joomla | dg_banner_clients          | table | joomla
 joomla | dg_banner_tracks           | table | joomla
 joomla | dg_banners                 | table | joomla
 joomla | dg_categories              | table | joomla
 joomla | dg_contact_details         | table | joomla
 joomla | dg_content                 | table | joomla
 joomla | dg_content_frontpage       | table | joomla
 joomla | dg_content_rating          | table | joomla
 joomla | dg_content_types           | table | joomla
 joomla | dg_contentitem_tag_map     | table | joomla
 joomla | dg_core_log_searches       | table | joomla
 joomla | dg_extensions              | table | joomla
 joomla | dg_finder_filters          | table | joomla
 joomla | dg_finder_links            | table | joomla
 joomla | dg_finder_links_terms0     | table | joomla
 joomla | dg_finder_links_terms1     | table | joomla
 joomla | dg_finder_links_terms2     | table | joomla
 joomla | dg_finder_links_terms3     | table | joomla
 joomla | dg_finder_links_terms4     | table | joomla
 joomla | dg_finder_links_terms5     | table | joomla
 joomla | dg_finder_links_terms6     | table | joomla
 joomla | dg_finder_links_terms7     | table | joomla
 joomla | dg_finder_links_terms8     | table | joomla
 joomla | dg_finder_links_terms9     | table | joomla
 joomla | dg_finder_links_termsa     | table | joomla
 joomla | dg_finder_links_termsb     | table | joomla
 joomla | dg_finder_links_termsc     | table | joomla
 joomla | dg_finder_links_termsd     | table | joomla
 joomla | dg_finder_links_termse     | table | joomla
 joomla | dg_finder_links_termsf     | table | joomla
 joomla | dg_finder_taxonomy         | table | joomla
 joomla | dg_finder_taxonomy_map     | table | joomla
 joomla | dg_finder_terms            | table | joomla
 joomla | dg_finder_terms_common     | table | joomla
 joomla | dg_finder_tokens           | table | joomla
 joomla | dg_finder_tokens_aggregate | table | joomla
 joomla | dg_finder_types            | table | joomla
 joomla | dg_languages               | table | joomla
 joomla | dg_menu                    | table | joomla
 joomla | dg_menu_types              | table | joomla
 joomla | dg_messages                | table | joomla
 joomla | dg_messages_cfg            | table | joomla
 joomla | dg_modules                 | table | joomla
 joomla | dg_modules_menu            | table | joomla
 joomla | dg_newsfeeds               | table | joomla
 joomla | dg_overrider               | table | joomla
 joomla | dg_postinstall_messages    | table | joomla
 joomla | dg_redirect_links          | table | joomla
 joomla | dg_schemas                 | table | joomla
 joomla | dg_session                 | table | joomla
 joomla | dg_tags                    | table | joomla
 joomla | dg_template_styles         | table | joomla
 joomla | dg_ucm_base                | table | joomla
 joomla | dg_ucm_content             | table | joomla
 joomla | dg_ucm_history             | table | joomla
 joomla | dg_update_sites            | table | joomla
 joomla | dg_update_sites_extensions | table | joomla
 joomla | dg_updates                 | table | joomla
 joomla | dg_user_keys               | table | joomla
 joomla | dg_user_notes              | table | joomla
 joomla | dg_user_profiles           | table | joomla
 joomla | dg_user_usergroup_map      | table | joomla
 joomla | dg_usergroups              | table | joomla
 joomla | dg_users                   | table | joomla
 joomla | dg_viewlevels              | table | joomla
 joomla | dg_weblinks                | table | joomla
(68 rows)

錯誤解決辦法 : 

 [參考]

6. joomla/installation/INSTALL


相關文章