前言
前几天,朋友手头上有一个空闲的vps,256M内存,我决定拿来玩一下。经过一番思考,还是用来挂站吧。然后看是CentOS6系统,果断决定用从来没玩过的LNMP。于是,百度、谷歌找教程,好多教程都是有问题的,导致重装无数次系统,浪费大把大把时间。现在总结一下成功的经验。
安装screen
在终端输入yum install screen
完成后输入screen -S lnmp
为什么要这样做呢?答案很简单,因为它可以保护您的远程连接,让工作不半路意外停止。我在安装LNMP的时候时间比较长,而XShell曾经莫名其妙断开,吓得我以为又要重新来过。还好一开始开了screen,进程还在。
如果您的终端在工作中意外断开,你可以输入screen –ls 来查看所有screen会话,然后输入screen –r + 代号 来恢复。
安装LNMP
在终端输入以下代码
wget -c http://soft.vpser.net/lnmp/lnmp1.1-full.tar.gz && tar zxf lnmp1.1-full.tar.gz && cd lnmp1.1-full && ./centos.sh
根据提示安装
这里要求输入MYSQL密码
然后输入这里需要确认是否启用MySQL InnoDB
选择php版本
选择mysql版本
我个人建议全部用最新的吧
漫长的等待。。。。。我用了三个小时。。。。。
大功告成
配置站点
环境装好了,如何让它可以挂站呢。
在终端输入 /root/vhost.sh
这里输入要绑定的域名,在这里,www.joycex.com和joycex.com不是同一个域名。建议在这里一起输入,两个域名间用空格间开。
如果你不小心打错了,用Ctrl+Backspace来删除,不要直接Backspace(这样子不会删除,反而出现^H)
回车后会出现如下提示
如果需要添加更多的域名,如不需要直接输入 n 回车。如需要输入 y 回车
接下来是设置网站目录位置,一般情况下不需要设置直接回车即可。
这里选择是否添加伪静态规则,如不需要伪静态,直接输入 n 回车。如果需要输入 y 回车,再选择伪静态或自定义伪静态
选择y就会出现以下提示
默认已经有了很多东西,可直接输入以上名称即可。
我们这里安装wordpress,直接输入wordpress就可以了。
下面是否选择开启日志
一般没什么用选择n
出现:Press any key to start create virtul host... 后,再次回车确认就会自动添加虚拟主机。
安装wordpress
鉴于用命令操作非常不方便,所有建议大家先下载到本地,然后用WinSCP这种SFTP软件上传到网站目录
首先去http://cn.wordpress.org/ 下载wordpress
用WinSCP上传
在浏览器输入http://域名/wp-admin/install.php
然后就进入了wordpress的经典安装界面,提示很简单,很容易安装
不到五分钟就大功告成了!

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.

In PHP, use the clone keyword to create a copy of the object and customize the cloning behavior through the \_\_clone magic method. 1. Use the clone keyword to make a shallow copy, cloning the object's properties but not the object's properties. 2. The \_\_clone method can deeply copy nested objects to avoid shallow copying problems. 3. Pay attention to avoid circular references and performance problems in cloning, and optimize cloning operations to improve efficiency.

PHP is suitable for web development and content management systems, and Python is suitable for data science, machine learning and automation scripts. 1.PHP performs well in building fast and scalable websites and applications and is commonly used in CMS such as WordPress. 2. Python has performed outstandingly in the fields of data science and machine learning, with rich libraries such as NumPy and TensorFlow.

Key players in HTTP cache headers include Cache-Control, ETag, and Last-Modified. 1.Cache-Control is used to control caching policies. Example: Cache-Control:max-age=3600,public. 2. ETag verifies resource changes through unique identifiers, example: ETag: "686897696a7c876b7e". 3.Last-Modified indicates the resource's last modification time, example: Last-Modified:Wed,21Oct201507:28:00GMT.

In PHP, password_hash and password_verify functions should be used to implement secure password hashing, and MD5 or SHA1 should not be used. 1) password_hash generates a hash containing salt values to enhance security. 2) Password_verify verify password and ensure security by comparing hash values. 3) MD5 and SHA1 are vulnerable and lack salt values, and are not suitable for modern password security.

PHP is a server-side scripting language used for dynamic web development and server-side applications. 1.PHP is an interpreted language that does not require compilation and is suitable for rapid development. 2. PHP code is embedded in HTML, making it easy to develop web pages. 3. PHP processes server-side logic, generates HTML output, and supports user interaction and data processing. 4. PHP can interact with the database, process form submission, and execute server-side tasks.

PHP has shaped the network over the past few decades and will continue to play an important role in web development. 1) PHP originated in 1994 and has become the first choice for developers due to its ease of use and seamless integration with MySQL. 2) Its core functions include generating dynamic content and integrating with the database, allowing the website to be updated in real time and displayed in personalized manner. 3) The wide application and ecosystem of PHP have driven its long-term impact, but it also faces version updates and security challenges. 4) Performance improvements in recent years, such as the release of PHP7, enable it to compete with modern languages. 5) In the future, PHP needs to deal with new challenges such as containerization and microservices, but its flexibility and active community make it adaptable.

The core benefits of PHP include ease of learning, strong web development support, rich libraries and frameworks, high performance and scalability, cross-platform compatibility, and cost-effectiveness. 1) Easy to learn and use, suitable for beginners; 2) Good integration with web servers and supports multiple databases; 3) Have powerful frameworks such as Laravel; 4) High performance can be achieved through optimization; 5) Support multiple operating systems; 6) Open source to reduce development costs.


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

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

WebStorm Mac version
Useful JavaScript development tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 English version
Recommended: Win version, supports code prompts!

Zend Studio 13.0.1
Powerful PHP integrated development environment