Archlinux 上 Nginx + PHP + Mariadb + DiscuzX2.5 安装小记
因为不好找下载集成服务器工具,而且他们自己又打包了一份 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>
配置 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>
启用以下扩展。去掉那行开头的分号即可。
<code>extension=curl.so extension=gd.so extension=gettext.so extension=mysql.so extension=mysqli.so extension=pdo_mysql.so </code>
配置 php-fpm
配置文件:/etc/php/php-fpm.conf
让 listen
的值与之前 nginx 配置中的 fastcgi_pass
值保持一致。
<code>listen = /run/php-fpm/php-fpm.sock </code>
配置数据库
设置数据库 root 密码
<code>mysql_secure_installation </code>
启动服务器
注意这些命令都需要 root 权限。
让服务器开机运行。
<code>systemctl enable nginx.service systemctl enable mysqld.service systemctl enable php-fpm.service </code>
启动服务器
<code>systemctl start nginx.service systemctl start mysqld.service systemctl start php-fpm.service </code>
安装 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>
接下来一步创建数据库。大部分设置顾名思义即可。
<code>数据库用户名:root 数据库密码:之前配置数据库的时候创建的root密码 </code>
下一步进行安装,世界和平。
之后会询问你是否开通 Discuz 云平台,直接点右边小字暂不开通。之后自动进入论坛。
接下来就随便你玩了。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



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 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.

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.

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? 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 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 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.

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
