Table of Contents
环境准备
配置 Nginx
配置 PHP
配置 php-fpm
配置数据库
启动服务器
安装 Discuz
Home php教程 php手册 Archlinux 上 Nginx + PHP + Mariadb + DiscuzX2.5 安装小记

Archlinux 上 Nginx + PHP + Mariadb + DiscuzX2.5 安装小记

Jun 06, 2016 pm 07:43 PM
di mariadb nginx php

因为不好找下载集成服务器工具,而且他们自己又打包了一份 php 之类的程序,本身系统就已经有 php 还有数据库什么的了再搞一份受不了,最后选择了手动配置 这是一个在 Archlinux 上手动从服务器程序开始部署 DiscuzX2.5 的全过程。 有的配置文件比较长,编辑

因为不好找下载集成服务器工具,而且他们自己又打包了一份 php 之类的程序,本身系统就已经有 php 还有数据库什么的了再搞一份受不了,最后选择了手动配置……

这是一个在 Archlinux 上手动从服务器程序开始部署 DiscuzX2.5 的全过程。

有的配置文件比较长,编辑的时候善用搜索 = =。

环境准备

  • 系统:Linux 3.16.4-1-ARCH
  • 服务器与相关软件:
    • nginx 1.6.2-1
    • php 5.6.1-1
    • php-fpm 5.6.1-1
    • mariadb 10.0.14-2
    • discuz x2.5

Discuz 是在这里获取的:http://www.discuz.net/thread-2744369-1-1.html,我选择的是 X2.5 UTF8 简体中文版

其它软件直接全部 pacman -S nginx php php-fpm mariadb 安装即可。

配置 Nginx

配置文件:/etc/nginx/nginx.conf

<code>http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        root /usr/share/nginx/html;
        location / {
            index  index.html index.htm index.php;
            #add_header Cache-Control privete;
        }

        location ~ \.php$ {
            fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
            fastcgi_index index.php;
            include fastcgi.conf;
        }
</code>
Copy after login

配置 PHP

配置文件: /etc/php/php.ini

open_basedir 中加上 nginx 服务器的根目录( /usr/share/nginx/html/ )。即告诉 php 程序要去解析那个目录下的 php 文件。

<code>open_basedir = /usr/share/nginx/html/:/srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/
</code>
Copy after login

启用以下扩展。去掉那行开头的分号即可。

<code>extension=curl.so
extension=gd.so
extension=gettext.so
extension=mysql.so
extension=mysqli.so
extension=pdo_mysql.so
</code>
Copy after login

配置 php-fpm

配置文件:/etc/php/php-fpm.conf

listen 的值与之前 nginx 配置中的 fastcgi_pass 值保持一致。

<code>listen = /run/php-fpm/php-fpm.sock
</code>
Copy after login

配置数据库

设置数据库 root 密码

<code>mysql_secure_installation
</code>
Copy after login

启动服务器

注意这些命令都需要 root 权限。

让服务器开机运行。

<code>systemctl enable nginx.service
systemctl enable mysqld.service
systemctl enable php-fpm.service
</code>
Copy after login

启动服务器

<code>systemctl start nginx.service
systemctl start mysqld.service
systemctl start php-fpm.service
</code>
Copy after login

安装 Discuz

将下载下来的 Discuz 程序包解压,将其中的 upload 文件夹复制到 nginx 服务器的目录下( /usr/share/nginx/html/ )。

打开浏览器,打开 http://localhost/upload/install/ 。

如果世界和平,你的配置一切正常的话,你应该会看到 Dizcuz 的使用协议页面,点击同意之后进入安装向导,向导会自动检测环境,如果你遇到了有 目录文件 没有权限或者找不到目录的话,使用 chmod 设置一下nginx 目录的文件权限。

<code>chmod -R a+rwx /usr/share/nginx/html/
</code>
Copy after login

接下来一步创建数据库。大部分设置顾名思义即可。

<code>数据库用户名:root
数据库密码:之前配置数据库的时候创建的root密码
</code>
Copy after login

下一步进行安装,世界和平。

之后会询问你是否开通 Discuz 云平台,直接点右边小字暂不开通。之后自动进入论坛。

接下来就随便你玩了。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to check whether nginx is started How to check whether nginx is started Apr 14, 2025 pm 01:03 PM

How to confirm whether Nginx is started: 1. Use the command line: systemctl status nginx (Linux/Unix), netstat -ano | findstr 80 (Windows); 2. Check whether port 80 is open; 3. Check the Nginx startup message in the system log; 4. Use third-party tools, such as Nagios, Zabbix, and Icinga.

PHP: Handling Databases and Server-Side Logic PHP: Handling Databases and Server-Side Logic Apr 15, 2025 am 12:15 AM

PHP uses MySQLi and PDO extensions to interact in database operations and server-side logic processing, and processes server-side logic through functions such as session management. 1) Use MySQLi or PDO to connect to the database and execute SQL queries. 2) Handle HTTP requests and user status through session management and other functions. 3) Use transactions to ensure the atomicity of database operations. 4) Prevent SQL injection, use exception handling and closing connections for debugging. 5) Optimize performance through indexing and cache, write highly readable code and perform error handling.

How to start nginx in Linux How to start nginx in Linux Apr 14, 2025 pm 12:51 PM

Steps to start Nginx in Linux: Check whether Nginx is installed. Use systemctl start nginx to start the Nginx service. Use systemctl enable nginx to enable automatic startup of Nginx at system startup. Use systemctl status nginx to verify that the startup is successful. Visit http://localhost in a web browser to view the default welcome page.

How to check whether nginx is started? How to check whether nginx is started? Apr 14, 2025 pm 12:48 PM

In Linux, use the following command to check whether Nginx is started: systemctl status nginx judges based on the command output: If "Active: active (running)" is displayed, Nginx is started. If "Active: inactive (dead)" is displayed, Nginx is stopped.

How to configure nginx in Windows How to configure nginx in Windows Apr 14, 2025 pm 12:57 PM

How to configure Nginx in Windows? Install Nginx and create a virtual host configuration. Modify the main configuration file and include the virtual host configuration. Start or reload Nginx. Test the configuration and view the website. Selectively enable SSL and configure SSL certificates. Selectively set the firewall to allow port 80 and 443 traffic.

PHP's Purpose: Building Dynamic Websites PHP's Purpose: Building Dynamic Websites Apr 15, 2025 am 12:18 AM

PHP is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.

How to solve nginx403 How to solve nginx403 Apr 14, 2025 am 10:33 AM

How to fix Nginx 403 Forbidden error? Check file or directory permissions; 2. Check .htaccess file; 3. Check Nginx configuration file; 4. Restart Nginx. Other possible causes include firewall rules, SELinux settings, or application issues.

How to start nginx server How to start nginx server Apr 14, 2025 pm 12:27 PM

Starting an Nginx server requires different steps according to different operating systems: Linux/Unix system: Install the Nginx package (for example, using apt-get or yum). Use systemctl to start an Nginx service (for example, sudo systemctl start nginx). Windows system: Download and install Windows binary files. Start Nginx using the nginx.exe executable (for example, nginx.exe -c conf\nginx.conf). No matter which operating system you use, you can access the server IP

See all articles