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

本文涉及的产品
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS PostgreSQL,集群系列 2核4GB
简介:
本文介绍一下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
相关实践学习
使用PolarDB和ECS搭建门户网站
本场景主要介绍基于PolarDB和ECS实现搭建门户网站。
阿里云数据库产品家族及特性
阿里云智能数据库产品团队一直致力于不断健全产品体系,提升产品性能,打磨产品功能,从而帮助客户实现更加极致的弹性能力、具备更强的扩展能力、并利用云设施进一步降低企业成本。以云原生+分布式为核心技术抓手,打造以自研的在线事务型(OLTP)数据库Polar DB和在线分析型(OLAP)数据库Analytic DB为代表的新一代企业级云原生数据库产品体系, 结合NoSQL数据库、数据库生态工具、云原生智能化数据库管控平台,为阿里巴巴经济体以及各个行业的企业客户和开发者提供从公共云到混合云再到私有云的完整解决方案,提供基于云基础设施进行数据从处理、到存储、再到计算与分析的一体化解决方案。本节课带你了解阿里云数据库产品家族及特性。
目录
相关文章
|
3月前
|
应用服务中间件 Linux 网络安全
如何在 CentOS 7 上为 Nginx 创建自签名 SSL 证书
如何在 CentOS 7 上为 Nginx 创建自签名 SSL 证书
184 1
|
3月前
|
SQL 关系型数据库 Linux
搭建 PostgreSQL 流复制主从指南(适用于 CentOS 7.x)
搭建 PostgreSQL 流复制主从指南(适用于 CentOS 7.x)
117 7
|
4月前
|
应用服务中间件 Linux nginx
让 CentOS 定时重启 Nginx
在CentOS上设置Nginx定时重启可通过`cron`或`systemctl`
244 0
|
30天前
|
应用服务中间件 Linux nginx
CentOS7安装Nginx
CentOS7安装Nginx
|
1月前
|
监控 应用服务中间件 nginx
详细解释容器以及虚拟机centos7.9容器化部署基础服务(容器化部署nginx)
容器是一种轻量级、可移植的软件打包和隔离技术,将应用程序及其依赖项打包,确保在任何环境中一致运行。容器共享主机操作系统内核,相比虚拟机更高效、轻量,具有快速启动和高资源利用率的特点。容器的关键技术包括命名空间(如 PID、NET 等)、控制组(cgroups)和联合文件系统(UnionFS)。使用容器可以提高开发和部署效率,简化管理,确保环境一致性。例如,在 CentOS 7.9 上部署 Nginx 时,可以通过 Docker 下载和运行 `nginx:1.20` 镜像,并通过端口映射使外部请求访问 Nginx 服务。此外,还可以将测试页面复制到容器中,进一步验证容器的功能。
|
3月前
|
应用服务中间件 Linux 网络安全
2022年超详细在CentOS 7上安装Nginx方法(源码安装)
这篇文章提供了在CentOS 7系统上通过源码安装Nginx的详细步骤,包括从官网下载Nginx源码包、上传至虚拟机、解压、删除压缩包、编译安装前的配置、安装PCRE库(因为Nginx使用PCRE库解析正则表达式)、安装zlib和OpenSSL库(用于支持HTTPS协议)、重新编译Nginx、安装后启动Nginx服务、关闭服务、修改默认端口、以及重启服务测试等步骤。文章还提供了相关命令和操作截图,帮助用户更好地理解和执行安装过程。
2022年超详细在CentOS 7上安装Nginx方法(源码安装)
|
3月前
|
Linux PHP
Linux CentOS 宝塔 Suhosin禁用php5.6版本eval函数详细图文教程
【8月更文挑战第27天】本文介绍两种禁用PHP执行的方法:使用`PHP_diseval_extension`禁用和通过`suhosin`禁用。由于`suhosin`不支持PHP8,仅适用于PHP7及以下版本,若服务器安装了PHP5.6,则需对应安装`suhosin-0.9.38`版本。文章提供了详细的安装步骤,并强调了宝塔环境下与普通环境下的PHP路径差异。安装完成后,在`php.ini`中添加`suhosin.so`扩展并设置`executor.disable_eval = on`以禁用执行功能。最后通过测试代码验证是否成功禁用,并重启`php-fpm`服务生效。
38 2
|
3月前
|
应用服务中间件 Linux nginx
在CentOS上使用源码包安装Nginx、以及手动启动Nginx的步骤过程
这篇文章介绍了在CentOS系统上使用Nginx源码包进行安装和配置的详细步骤,包括源码包的获取、解压、配置、编译、安装、启动验证以及注意事项。
320 0
在CentOS上使用源码包安装Nginx、以及手动启动Nginx的步骤过程
|
3月前
|
Linux PHP Apache
centos7安装php8
centos7安装php8
245 1
|
3月前
|
物联网 应用服务中间件 Linux
CentOS7.9 Nginx+EMQX集群组建MQTTS平台
通过以上步骤,您已成功搭建了一个基于CentOS 7.9、Nginx和EMQX的MQTTS平台。这个平台既能保证数据传输的安全性,又能利用Nginx的负载均衡能力和EMQX的高性能、高并发处理能力,实现稳定高效的消息服务。在部署和配置过程中,务必注意证书、域名以及EMQX配置的正确性,确保系统安全和稳定运行。此外,定期更新软件和系统,以及监控系统性能,也是保证MQTTS平台长期稳定运行的重要环节。
96 4