Joomla, PHP, Nginx, PostgreSQL, fpm on CentOS 6.4 x64-阿里云开发者社区

开发者社区> 开发与运维> 正文
登录阅读全文

Joomla, PHP, Nginx, PostgreSQL, fpm on CentOS 6.4 x64

简介:
本文介绍一下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

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

分享:
开发与运维
使用钉钉扫一扫加入圈子
+ 订阅

集结各类场景实战经验,助你开发运维畅行无忧

其他文章
最新文章
相关文章