What is the basic layout of a webserver? [closed] - php

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
Hi Im wondering how to make a basic directory layout for a client if you have php and mysql embeded. I mean the folder layout, and how to name them. So that everyone that develops in the web can recognize it. Is there any special way to do this?

Basic can mean a lot here. The most basic web hosts I worked with just have one folder in it. www (or htdocs, httpdocs, public_html, html) The domain is configured to point into this folder. All files are accessible from the web. Older webservers often had separate folders for perl, cgi, python, etc. stuff. More advanced server offer more folders, for example for logs, automated backups. It can be a good practice for some frameworks to have a separate folder for the source files and create a symlink in the public folder. It really depends on what you want to offer to your client. I would suggest to first of all make a plan on what you want to offer and then try to build a folder structure that mirrors a modular server build. For naming conventions, there are no real standards.

Related

Best way to implement my own storage service? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
Let's say I want to implement storage server, which would be used as a place to store files, images, etc. from different websites. Something like S3, but only for my projects.
I thought about some API/Gateway on PHP, which would save files from those websites to appropriate server, but is it a good way? And should I use Webdav or maybe NFS/SMB, which protocol is more secure and fast?
Can you please give me advice how to create my own storage server? Especially I want to hear about appropriate stack for that, thank you.
There are a number of projects for building your own NAS or SAN (I think that is what you're looking for). Look at the FreeNAS project for example. It does require quite a bit of memory though (depending on the size of your storage and the demands you put on it).
When you want to build your own NAS, you will not need very powerful CPU's, unless you want to run apps on the NAS (FreeNAS provides a system for runnning containerized applications on the NAS, using it's storage) but you will need memory and of course plenty of disks, again depending on what your exact requirements are.
However, if you're simply looking for a place to store your own files and they are not extremely large or a huge number of files, then you could simply build a Linux server and push (or pull) the files using SFTP, it only uses OpenSSH and a single port, fully encrypted with minimal overhead.

Where to store script files for cronjobs? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
In which diretory should script files for cronjobs be saved? Available to the public inside var/www/html or better inside var/www/files or ...?
Re-posting comments from above, for easier reference and clarity:
Why would you want to make cronjob script files available to the public? If you're distributing them, var/www/* would be a fine place to put them. If you're intending to run them on your server, put them somewhere that isn't public facing, like your /home directory
Cron only needs its scripts to be in a directory it can access. While it can definitely access /var/www/, so can (potentially) the public; it depends on your configuration. If you're running Apache as your web-server, then accessibility of any directory under the web root (usually, and likely in this case, /var/www) is configured by .htaccess files (or in a Directory block in your main server config). By default, all sub-directories and files are accessible. If you don't care about other people seeing your cron scripts, go ahead and put it in var/www. Otherwise, put them somewhere else or change your server configuration
The best way to do that you want, is create a new directory dedicated to save the scripts, for example, /var/www/html/scripts
In that way, people is able to see the the sctipts and for crontab schedule too.

centralize PHP code and MySQL data [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I currently have a dedicated server and I'm looking to set up a MySQL database, PHP query code and images directory that can be used by multiple sites. A majority of the sites will be hosted on the same machine, but some will not. My simple way of thinking is that this is possible similar to how Roundcube's code and database is centralized.
Looking for some expert input and direction on whether or not it is this simple or if there is a better way of accomplishing this.
In my opinion, you could two a couple of things to improve your situation:
store your images in just one place, and use that place as a CDN to deliver contents across your sites;
About your code:
if it's possible, use packages in order to create a single package for all the "common" code;
use this package on every site that needs that code, as a simple dependency. Tools like Composer are great to handle dependency management;
No big problems with MySQL databases unless you have big traffic numbers. In that case, you should study MySQL scaling. But first of all, focus on PHP and common assets (like images).
EDIT:
be sure to set appropriate permissions for the external sites, of course;
using packages for your dependencies will be very useful also for sites placed outside the dedicated server;

What to include in software metric calculation on laravel project? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Laravel project contain a lot of files and folder.
When we are calculating the Software Metric, should we include them all?
I am using phpmetric but it ignored the vendor folder.
But when I use phpdepend , it included that folder.
Thanks.
It depends on what you're measuring, which is why there's no one answer and similar tools may, or may not, include the vendor folder.
If you're interested in the analyzing your own project, then you'll want to point these tools at files you'll be editing. In Laravel 5 that mostly means the app folder -- but you might want to include config and bootstrap, as user created code often finds its ways in those folders.
A reason you might point it at vendor is if you were concerned about the direction a particular code library you use is going, and wanted to measure it over time.
Hope that helps!
vendors (external code) is not important for you. When you measure your project, you should measure YOUR code only:
vendors are already tested / measured in their own repository
if you include external librairies, you don't measure your work
your should exclude generated files (cache...). They are not representative of your work
you should exclude test files : they do not obey the same quality rules
If you want to get information about a particular code library you use, you can check the Github repository of this library. There is a list of PhpMetrics representations of main PHP projects, you can also keep on eye on it.

Web (PHP) application deployment strategy [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I m thinking about right deployment strategy for PHP (or any) web application.
I have versioned code (git) which contains source codes like LESS, non minified JavaScript etc.
As ideal steps I see this ones:
Build app to /build directory - including compile LESS, minify JavaScript and others. In build directory will be everything ready for deployment.
Run other necessary scripts like tests etc. in /build directory
After this steps I'm a bit confused what to do next.
Whole /build directory should be copied to staging/production server, but before I was actually building app I've used to copy only files which changed from last Git commit. Copying all files seems to be inefficient for me. However versioning /build directory doesn't seem to be right thing as well.
Other possibility is to create /build directory but it seems to be too messy to have built and non built files together and all versioned.
How do you build and deploy web applications?
If you use Jenkins/Hudson CI then you can use different publish plugins which may be executed after successful build. Most of plugins allow you to say exactly what you want to be published and over what protocol.
Basically you run full build on Jenkins, then deliver your build files and artifacts to production server.
Look at Publish Over SSH or Publish Over FTP. Both plugins allow you to configure "Transfer Set" and if you uncheck "Clean remote" checkbox then plugins will only send out files that are different from your production host.
PS: I made an assumption that you use CI server of some sort given tag "continuous-integration"

Categories